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

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

Llist = []

for i in range(M - 1):

    Llist.append(Xlist[i + 1] - Xlist[i])

Llist.sort()

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

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

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

sbn = sorted([abs(Xlist[i + 1] - Xlist[i]) for i in range(M - 1)])[::-1]

if N >= M:

    print((0))

else:

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

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

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

-Llist = [] -for i in range(M - 1): -    Llist.append(Xlist[i + 1] - Xlist[i]) -Llist.sort() -print((sum(Llist[: M - N]) if N < M else 0)) +sbn = sorted([abs(Xlist[i + 1] - Xlist[i]) for i in range(M - 1)])[::-1] +if N >= M: +    print((0)) +else: +    print((sum(sbn[N - 1 :])))