#include <bits/stdc++.h>
using namespace std;
signed long long int a[100000 + 5], b[100000 + 5];
int n, m;
signed long long int func(signed long long int x) {
  signed long long int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] < x) ans += x - a[i];
  }
  for (int i = 1; i <= m; ++i) {
    if (x < b[i]) ans += b[i] - x;
  }
  return ans;
}
signed long long int ter(signed long long int i, signed long long int j) {
  if (i == j) return i;
  if (j - i == 2) {
    signed long long int mi = j - 1;
    if (func(mi) < func(i) && func(mi) < func(j)) return mi;
    if (func(i) < func(j) && func(i) < func(mi)) return i;
    return j;
  }
  signed long long int l, r;
  l = i + (j - i) / 3;
  r = j - (j - i) / 3;
  if (func(l) > func(r))
    return ter(l, j);
  else
    return ter(i, r);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) cin >> b[i];
  cout << func(ter(0, 2 * 1000000007 + 1));
}
