#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long a[100000], b[100000];
long long val(long long p) {
  long long ret = 0;
  for (long long i = 0; i < n; ++i) ret += max((long long)0, p - a[i]);
  for (long long i = m - 1; i >= 0; --i) ret += max((long long)0, b[i] - p);
  return ret;
}
int32_t main() {
  cin >> n >> m;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  for (long long i = 0; i < m; ++i) cin >> b[i];
  sort(a, a + n), sort(b, b + m);
  long long l = 0, r = 1e9 + 1, m1, m2, v1, v2;
  long long ans = LLONG_MAX;
  while (l <= r) {
    m1 = l + (r - l) / 3;
    m2 = l + 2 * (r - l) / 3;
    v1 = val(m1), v2 = val(m2);
    if (v1 <= v2) {
      ans = min(v1, ans);
      r = m2 - 1;
    } else {
      ans = min(v2, ans);
      l = m1 + 1;
    }
  }
  cout << ans;
}
