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

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

d=sorted(j-i for i,j in zip(X,X[1:]))[::-1]

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

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

s=[]

for i in range(M-1):s.append(X[i+1]-X[i])

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

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

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

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