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

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

if n >= m:

    print((0))

    exit()

x_s.sort()

sa=[]



for i in range(m-1):

    sa.append(x_s[i+1]-x_s[i])

sa.sort()



print((sum(sa)-sum(sa[m-n:m])))

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

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

X.sort()



if n >= m:

    print((0))

    exit()



sa = []



for i in range(1, m):

    sa.append(abs(X[i] - X[i - 1]))



sa.sort(reverse=True)

# print(sa)

# print((max(X) - min(X)))

print(((max(X) - min(X)) - sum(sa[:n-1])))

n, m = list(map(int, input().split()))
x_s = list(map(int, input().split()))
if n >= m:
    print((0))
    exit()
x_s.sort()
sa = []
for i in range(m - 1):
    sa.append(x_s[i + 1] - x_s[i])
sa.sort()
print((sum(sa) - sum(sa[m - n : m])))

n, m = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
if n >= m:
    print((0))
    exit()
sa = []
for i in range(1, m):
    sa.append(abs(X[i] - X[i - 1]))
sa.sort(reverse=True)
# print(sa)
# print((max(X) - min(X)))
print(((max(X) - min(X)) - sum(sa[: n - 1])))

-x_s = list(map(int, input().split())) +X = list(map(int, input().split())) +X.sort() -x_s.sort() -for i in range(m - 1): -    sa.append(x_s[i + 1] - x_s[i]) -sa.sort() -print((sum(sa) - sum(sa[m - n : m]))) +for i in range(1, m): +    sa.append(abs(X[i] - X[i - 1])) +sa.sort(reverse=True) +# print(sa) +# print((max(X) - min(X))) +print(((max(X) - min(X)) - sum(sa[: n - 1])))