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

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

dist = sorted([abs(X[i] - X[i+1]) for i in range(M-1)])

print((sum(dist[:M-N]) if N < M else 0))

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

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

dist = sorted([X[i+1] - X[i] for i in range(M-1)])[::-1]

print((sum(dist[N-1:])))

N, M = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
dist = sorted([abs(X[i] - X[i + 1]) for i in range(M - 1)])
print((sum(dist[: M - N]) if N < M else 0))

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

-X = sorted(list(map(int, input().split()))) -dist = sorted([abs(X[i] - X[i + 1]) for i in range(M - 1)]) -print((sum(dist[: M - N]) if N < M else 0)) +X = sorted(map(int, input().split())) +dist = sorted([X[i + 1] - X[i] for i in range(M - 1)])[::-1] +print((sum(dist[N - 1 :])))