#include <bits/stdc++.h>
using namespace std;
long long a[100100], b[100100], n, m;
long long check(long long val) {
  long long rez = 0;
  for (int i = 0; i < n; i++)
    if (a[i] < val) rez += val - a[i];
  for (int i = 0; i < m; i++)
    if (b[i] > val) rez += b[i] - val;
  return rez;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  long long st = 0, dr = 1e9, mid1, mid;
  while (st + 5 < dr) {
    mid = st + (dr - st) / 3;
    mid1 = dr - (dr - st) / 3;
    if (check(mid) > check(mid1))
      st = mid;
    else
      dr = mid1;
  }
  long long rez = 1LL << 50;
  for (; st <= dr; st++) rez = min(rez, check(st));
  cout << max(0LL, rez);
}
