#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 5, inf = 2e9, mod = 1e9 + 7;
vector<int> prime_Numbers;
bool primes[1000005];
double dot(complex<double> a, complex<double> b) {
  return (conj(a) * b).real();
}
double cross(complex<double> a, complex<double> b) {
  return (conj(a) * b).imag();
}
long long n, m;
long long a[100005], b[100005];
long long solve(long long mid) {
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (mid > a[i]) ans += mid - a[i];
  }
  for (int i = 0; i < m; i++) {
    if (mid < b[i]) ans += b[i] - mid;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    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 s = 0, e = 1e9, mid1, mid2;
    while (e - s > 2) {
      mid1 = s + (e - s) / 3;
      mid2 = e - (e - s) / 3;
      long long ans1 = solve(mid1);
      long long ans2 = solve(mid2);
      if (ans1 < ans2)
        e = mid2;
      else
        s = mid1;
    }
    long long ans = 1e18;
    for (int i = s; i <= e; i++) {
      ans = min(ans, solve(i));
    }
    cout << ans << endl;
  }
  return 0;
}
