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>).
def binarySearchCount(arr, n, key): 
  
    left = 0
    right = n - 1
  
    count = 0
  
    while (left <= right):  
        mid = int((right + left) / 2) 
  
        # Check if middle element is 
        # less than or equal to key 
        if (arr[mid] < key):  
  
            # At least (mid + 1) elements are there 
            # whose values are less than 
            # or equal to key 
            count = mid + 1
            left = mid + 1
          
        # If key is smaller, ignore right half 
        else: 
            right = mid - 1
      
    return count 
def countGreater(arr, n, k): 
    l = 0
    r = n - 1
  
    # Stores the index of the left most element 
    # from the array which is greater than k 
    leftGreater = n 
  
    # Finds number of elements greater than k 
    while (l <= r): 
        m = int(l + (r - l) / 2) 
  
        # If mid element is greater than 
        # k update leftGreater and r 
        if (arr[m] > k): 
            leftGreater = m 
            r = m - 1
  
        # If mid element is less than 
        # or equal to k update l 
        else: 
            l = m + 1
  
    # Return the count of elements  
    # greater than k 
    return (n - leftGreater) 
class SegmentTree:
    def __init__(self, data, default=0, func=lambda a,b:a+b):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()
 
        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])
 
    def __delitem__(self, idx):
        self[idx] = self._default
 
    def __getitem__(self, idx):
        return self.data[idx + self._size]
 
    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1
 
    def __len__(self):
        return self._len
 
    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size
 
        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res
 
    def __repr__(self):
        return "SegmentTree({0})".format(self.data)
m,n=map(int,input().split())
b=list(map(int,input().split()))
a=list(map(int,input().split()))
tot=9999999999999999999999999999999
s=SegmentTree(a)
#print(s.query(n,n-1))
s1=SegmentTree(b)
for i in range(n):
    c=binarySearchCount(b,m,a[i])
    #print(a[i],c)
    ans=c*a[i]-s1.query(0,c-1)-(n-1-i)*a[i]+s.query(i+1,n-1)
    #print(ans)
    tot=min(ans,tot)    
for i in range(m):
    c=countGreater(a,n,b[i])
    ans=-(c)*b[i]+s.query(n-c,n-1)-s1.query(0,i-1)+(i)*b[i]
    #print(ans)
    tot=min(ans,tot)
print(tot)