N,M= [int(s) for s in input().split()]

lst = [int(s) for s in input().split()]

lst.sort()

gap=[]

for i in range(1,M):

  gap.append(lst[i]-lst[i-1])

gap.sort()

ans=0

for i in range(M-N):

  ans+=gap[i]

print(ans)
N,M=[int(s) for s in input().split()]

if N>=M:

  print((0))

else:

  ls=[int(s) for s in input().split()]

  ls.sort()

  d=[ls[i+1]-ls[i] for i in range(M-1)]

  d.sort()

  print((sum(d[:M-N])))
N, M = [int(s) for s in input().split()]
lst = [int(s) for s in input().split()]
lst.sort()
gap = []
for i in range(1, M):
    gap.append(lst[i] - lst[i - 1])
gap.sort()
ans = 0
for i in range(M - N):
    ans += gap[i]
print(ans)

N, M = [int(s) for s in input().split()]
if N >= M:
    print((0))
else:
    ls = [int(s) for s in input().split()]
    ls.sort()
    d = [ls[i + 1] - ls[i] for i in range(M - 1)]
    d.sort()
    print((sum(d[: M - N])))

-lst = [int(s) for s in input().split()] -lst.sort() -gap = [] -for i in range(1, M): -    gap.append(lst[i] - lst[i - 1]) -gap.sort() -ans = 0 -for i in range(M - N): -    ans += gap[i] -print(ans) +if N >= M: +    print((0)) +else: +    ls = [int(s) for s in input().split()] +    ls.sort() +    d = [ls[i + 1] - ls[i] for i in range(M - 1)] +    d.sort() +    print((sum(d[: M - N])))