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

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



x = sorted(X)



diff = []

for n in range(1, M):

	diff += [abs(x[n] - x[n - 1])]

diff.sort(reverse=True)



print((abs(x[-1] - x[0]) - sum(diff[:N - 1])))

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

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



x = sorted(X)

x_diff = [(x[m] - x[m - 1]) for m in range(1, M)]

x_diff.sort(reverse=True)



print(((x[-1] - x[0]) - sum(x_diff[:N - 1])))

N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
x = sorted(X)
diff = []
for n in range(1, M):
    diff += [abs(x[n] - x[n - 1])]
diff.sort(reverse=True)
print((abs(x[-1] - x[0]) - sum(diff[: N - 1])))

N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
x = sorted(X)
x_diff = [(x[m] - x[m - 1]) for m in range(1, M)]
x_diff.sort(reverse=True)
print(((x[-1] - x[0]) - sum(x_diff[: N - 1])))

-diff = [] -for n in range(1, M): -    diff += [abs(x[n] - x[n - 1])] -diff.sort(reverse=True) -print((abs(x[-1] - x[0]) - sum(diff[: N - 1]))) +x_diff = [(x[m] - x[m - 1]) for m in range(1, M)] +x_diff.sort(reverse=True) +print(((x[-1] - x[0]) - sum(x_diff[: N - 1])))