Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays *a* and *b* by their father. The array *a* is given to Devu and *b* to his brother. 

As Devu is really a naughty kid, he wants the minimum value of his array *a* should be at least as much as the maximum value of his brother's array *b*. 

Now you have to help Devu in achieving this condition. You can perform multiple operations on the arrays. In a single operation, you are allowed to decrease or increase any element of any of the arrays by 1. Note that you are allowed to apply the operation on any index of the array multiple times.

You need to find minimum number of operations required to satisfy Devu's condition so that the brothers can play peacefully without fighting.
The first line contains two space-separated integers *n*, *m* (1 ≤ *n*, *m* ≤ 10<sup class="upper-index">5</sup>). The second line will contain *n* space-separated integers representing content of the array *a* (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>). The third line will contain *m* space-separated integers representing content of the array *b* (1 ≤ *b*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).
n, m = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

# TLE >:[
# Ok, so new summing algorithm cuts loops from 8 * 10^6 -> 2 * 10^5 so that's good!

A.sort()
B.sort()

sums_of_A = [0] * n
current_sum = 0
for i in range(n):
    current_sum += A[i]
    sums_of_A[i] = current_sum


sums_of_B = [0] * m
current_sum = 0
for i in range(m-1, -1, -1):
    current_sum += B[i]
    sums_of_B[i] = current_sum

loops = n + m

# Binary Search
# Returns i*, the first instance of array[i] >= value
def first_instance_of_greater_or_equal(array, value):
    global loops

    N = len(array)
    
    left = 0
    right = N
    
    while right > left:
        middle = (right + left) // 2

        if array[middle] < value:
            left = middle + 1

        elif array[middle] >= value:
            right = middle

        loops += 1

    return left

# Binary Search
# Returns i*, the first instance of array[i] > value
def first_instance_of_greater(array, value):
    global loops

    N = len(array)
    
    left = 0
    right = N
    
    while right > left:
        middle = (right + left) // 2

        if array[middle] <= value:
            left = middle + 1

        elif array[middle] > value:
            right = middle

        loops += 1

    return left

# Nivelar hacia arriba
def cost_A(b):

    if b <= A[0]:
        return 0

    # Index is the last instance of A[i] < b
    index = first_instance_of_greater_or_equal(A, b) - 1
    S = sums_of_A[index]

    return b*(index+1) - S

# Nivelar hacia abajo
def cost_B(b):

    if b >= B[-1]:
        return 0

    index = first_instance_of_greater(B, b)
    S = sums_of_B[index]

    return S - b*(m-index)

def cost(b):
    cA = cost_A(b)
    cB = cost_B(b)

    return cA + cB

left = min(A[0], B[0])
right = max(A[-1], B[-1])

# Ternary Search
third = 1
while third > 0:
    third = (right - left) // 3

    b1 = left + third
    b2 = left + 2*third

    val1 = cost(b1)
    val2 = cost(b2)

    if val1 >= val2:
        left = b1

    if val2 >= val1:
        right = b2

v1 = cost(left)
v2 = cost(left + 1)
v3 = cost(left + 2)

print(min(v1, v2, v3))
				  		 	  		 		  	 		    	