N,M=list(map(int,input().split()))

X=sorted(list(map(int,input().split())))

d=[0]*(M-1)

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

  d[i]=X[i+1]-X[i]

d=sorted(d)[::-1]

print((sum(d[N-1:])))
N,M=list(map(int,input().split()))

X=sorted(list(map(int,input().split())))

print((sum(sorted([X[i+1]-X[i] for i in range(M-1)])[::-1][N-1:])))
N, M = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
d = [0] * (M - 1)
for i in range(len(X) - 1):
    d[i] = X[i + 1] - X[i]
d = sorted(d)[::-1]
print((sum(d[N - 1 :])))

N, M = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
print((sum(sorted([X[i + 1] - X[i] for i in range(M - 1)])[::-1][N - 1 :])))

-d = [0] * (M - 1) -for i in range(len(X) - 1): -    d[i] = X[i + 1] - X[i] -d = sorted(d)[::-1] -print((sum(d[N - 1 :]))) +print((sum(sorted([X[i + 1] - X[i] for i in range(M - 1)])[::-1][N - 1 :])))