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

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

if(N>=M):

    print((0))

else:

    X.sort()

    b=[]

    for i in range(M-1):

        b.append(X[i+1]-X[i])

    b.sort()

    for _ in range(N-1):

        b.pop()

    print((sum(b)))

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

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

if n>=m:

    print((0))

    exit()

s=l[-1]-l[0]

l=sorted([a-b for a,b in zip(l[1:],l)], reverse=True)

print((s-sum(l[:n-1])))

N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
if N >= M:
    print((0))
else:
    X.sort()
    b = []
    for i in range(M - 1):
        b.append(X[i + 1] - X[i])
    b.sort()
    for _ in range(N - 1):
        b.pop()
    print((sum(b)))

n, m = list(map(int, input().split()))
l = sorted(list(map(int, input().split())))
if n >= m:
    print((0))
    exit()
s = l[-1] - l[0]
l = sorted([a - b for a, b in zip(l[1:], l)], reverse=True)
print((s - sum(l[: n - 1])))

-N, M = list(map(int, input().split())) -X = list(map(int, input().split())) -if N >= M: +n, m = list(map(int, input().split())) +l = sorted(list(map(int, input().split()))) +if n >= m: -else: -    X.sort() -    b = [] -    for i in range(M - 1): -        b.append(X[i + 1] - X[i]) -    b.sort() -    for _ in range(N - 1): -        b.pop() -    print((sum(b))) +    exit() +s = l[-1] - l[0] +l = sorted([a - b for a, b in zip(l[1:], l)], reverse=True) +print((s - sum(l[: n - 1])))