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

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

d = [0] * (m - 1)

for i in range(1, m):

    d[i - 1] = abs(L[i] - L[i - 1])

d = sorted(d, reverse=True)[(n - 1):]

print((sum(d)))

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

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

d = [L[i + 1] - L[i] for i in range(m - 1)]

d.sort(reverse=True)

print((sum(d[(n - 1):])))

n, m = list(map(int, input().split()))
L = sorted(map(int, input().split()))
d = [0] * (m - 1)
for i in range(1, m):
    d[i - 1] = abs(L[i] - L[i - 1])
d = sorted(d, reverse=True)[(n - 1) :]
print((sum(d)))

n, m = list(map(int, input().split()))
L = sorted(map(int, input().split()))
d = [L[i + 1] - L[i] for i in range(m - 1)]
d.sort(reverse=True)
print((sum(d[(n - 1) :])))

-d = [0] * (m - 1) -for i in range(1, m): -    d[i - 1] = abs(L[i] - L[i - 1]) -d = sorted(d, reverse=True)[(n - 1) :] -print((sum(d))) +d = [L[i + 1] - L[i] for i in range(m - 1)] +d.sort(reverse=True) +print((sum(d[(n - 1) :])))