# coding: utf-8

# Your code here!

a = list(map(int,input().split()))

b = list(map(int,input().split()))

b.sort()



c = []

if len(b) != 1:

  for i in range(len(b) - 1):

    c.append(b[i+1] - b[i])



if len(b) == 1:

  print((0))

  

    

else:  

  c.sort()

  for j in range(min(a[0] - 1,a[1])):

    c[len(c)- 1 - j] = 0

  print((sum(c)))



a,b = list(map(int,input().split()))



c = list(map(int,input().split()))

c.sort()



d = []

for i in range(b-1):

    d.append(c[i+1] - c[i])



d.sort()



#print(c,d)



for k in range(a - 1):

    if d == []:

        print((0))

        exit()

    d.pop()



print((sum(d)))
# coding: utf-8
# Your code here!
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort()
c = []
if len(b) != 1:
    for i in range(len(b) - 1):
        c.append(b[i + 1] - b[i])
if len(b) == 1:
    print((0))
else:
    c.sort()
    for j in range(min(a[0] - 1, a[1])):
        c[len(c) - 1 - j] = 0
    print((sum(c)))

a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort()
d = []
for i in range(b - 1):
    d.append(c[i + 1] - c[i])
d.sort()
# print(c,d)
for k in range(a - 1):
    if d == []:
        print((0))
        exit()
    d.pop()
print((sum(d)))

-# coding: utf-8 -# Your code here! -a = list(map(int, input().split())) -b = list(map(int, input().split())) -b.sort() -c = [] -if len(b) != 1: -    for i in range(len(b) - 1): -        c.append(b[i + 1] - b[i]) -if len(b) == 1: -    print((0)) -else: -    c.sort() -    for j in range(min(a[0] - 1, a[1])): -        c[len(c) - 1 - j] = 0 -    print((sum(c))) +a, b = list(map(int, input().split())) +c = list(map(int, input().split())) +c.sort() +d = [] +for i in range(b - 1): +    d.append(c[i + 1] - c[i]) +d.sort() +# print(c,d) +for k in range(a - 1): +    if d == []: +        print((0)) +        exit() +    d.pop() +print((sum(d)))