#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 1;
int n, m;
int a[maxn], b[maxn];
long long get(int x) {
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    if (x <= a[i]) {
      break;
    }
    res += x - a[i];
  }
  for (int i = m; i >= 1; i--) {
    if (b[i] < x) {
      break;
    }
    res += b[i] - x;
  }
  return res;
}
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];
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  int l = min(a[1], b[1]), r = max(a[n], b[m]);
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (get(mid) > get(mid + 1)) {
      l = mid;
    } else {
      r = mid;
    }
  }
  cout << min(get(l), get(r));
}
