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

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

D = sorted(j-i for i,j in zip(X,X[1:]))[::-1]

print((sum(D[N-1:])))
N,M = list(map(int,input().split()))

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

D = sorted([X[n+1]-X[n] for n in range(M-1)])



if M<=N:

  print((0))

else:

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

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

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