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>).
import itertools
import math
import threading
import time
from builtins import input, range
from math import gcd as gcd
import sys
from io import BytesIO, IOBase
import queue
import itertools
import collections
from heapq import heappop, heappush
import random
import os
from random import randint
import decimal
from math import factorial as fac


def solve():
    def ans(x):
        res = 0
        for i in range(len(a)):
            res += max(0, x - a[i])
        for i in range(len(b)):
            res += max(0, b[i] - x)
        return res

    n, m = map(int, sys.stdin.readline().split())
    a = list(map(int, sys.stdin.readline().split()))
    b = list(map(int, sys.stdin.readline().split()))

    l = min(a)
    r = max(b)

    if l >= r:
        print(0)
        return

    while l + 3 < r:
        m1 = l + (r - l + 1) // 2
        m2 = l + 2 * ((r - l + 1) // 2)

        if ans(m1) < ans(m2):
            r = m2 - 1
        else:
            l = m1 + 1

    mn = 1 << 60
    for i in range(l, r + 1):
        mn = min(mn, ans(i))

    print(mn)


if __name__ == '__main__':
    multytest = False

    if multytest:
        t = int(input())
        for i in range(t):
            solve()
    else:
        solve()
