n,m = list(map(int,input().split()))



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



t.sort()

memo = []

for i in range(m-1):

    memo.append(t[i+1]-t[i])

memo.sort()

#print(memo)

ans = 0

for i in range(m-n):

    #print(i)

    ans += memo[i]

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



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



X.sort()



memo = []



for i in range(1,M):

    memo.append(X[i]-X[i-1])



memo.sort()

#print(memo)

ans = 0

for i in range(M-N):

    ans += memo[i]

print(ans)
n, m = list(map(int, input().split()))
t = list(map(int, input().split()))
t.sort()
memo = []
for i in range(m - 1):
    memo.append(t[i + 1] - t[i])
memo.sort()
# print(memo)
ans = 0
for i in range(m - n):
    # print(i)
    ans += memo[i]
print(ans)

N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
memo = []
for i in range(1, M):
    memo.append(X[i] - X[i - 1])
memo.sort()
# print(memo)
ans = 0
for i in range(M - N):
    ans += memo[i]
print(ans)

-n, m = list(map(int, input().split())) -t = list(map(int, input().split())) -t.sort() +N, M = list(map(int, input().split())) +X = list(map(int, input().split())) +X.sort() -for i in range(m - 1): -    memo.append(t[i + 1] - t[i]) +for i in range(1, M): +    memo.append(X[i] - X[i - 1]) -for i in range(m - n): -    # print(i) +for i in range(M - N):