#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
long long n, array1[N], array2[N], m;
long long cost(long long x) {
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    if (array1[i] < x) {
      sum += x - array1[i];
    }
  }
  for (int i = 0; i < m; ++i) {
    if (array2[i] > x) {
      sum += array2[i] - x;
    }
  }
  return sum;
}
int main() {
  long long i, l, r, mid, ans, num;
  scanf("%I64d %I64d", &n, &m);
  for (i = 0; i < n; ++i) {
    scanf("%I64d", &array1[i]);
  }
  for (i = 0; i < m; ++i) {
    scanf("%I64d", &array2[i]);
  }
  l = 1, r = 1e9 + 5;
  while (l <= r) {
    mid = l + (r - l) / 2;
    long long ansmid = cost(mid), ansleft = cost(mid - 1),
              ansright = cost(mid + 1);
    if (ansmid <= ansleft && ansmid <= ansright) {
      ans = ansmid;
      break;
    } else if (ansmid <= ansright && ansmid >= ansleft) {
      r = mid - 1;
    } else if (ansmid <= ansleft && ansmid >= ansright) {
      l = mid + 1;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
