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

x=sorted([int(i) for i in input().split()])

xbet=sorted([abs(x[i+1]-x[i]) for i in range(m-1)],reverse=True)

y=sum(xbet)

if n>=m:

    print((0))

else:

    print((y-sum(xbet[:n-1])))

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

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

x.sort()

y=[x[i]-x[i-1] for i in range(1,m)]

y.sort()

print((0 if n>=m else sum(y[:(m-n)])))
n, m = list(map(int, input().split()))
x = sorted([int(i) for i in input().split()])
xbet = sorted([abs(x[i + 1] - x[i]) for i in range(m - 1)], reverse=True)
y = sum(xbet)
if n >= m:
    print((0))
else:
    print((y - sum(xbet[: n - 1])))

n, m = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
y = [x[i] - x[i - 1] for i in range(1, m)]
y.sort()
print((0 if n >= m else sum(y[: (m - n)])))

-x = sorted([int(i) for i in input().split()]) -xbet = sorted([abs(x[i + 1] - x[i]) for i in range(m - 1)], reverse=True) -y = sum(xbet) -if n >= m: -    print((0)) -else: -    print((y - sum(xbet[: n - 1]))) +x = list(map(int, input().split())) +x.sort() +y = [x[i] - x[i - 1] for i in range(1, m)] +y.sort() +print((0 if n >= m else sum(y[: (m - n)])))