#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
long long n, m;
long long a[N], b[N];
long long f(long long x) {
  long long res = 0;
  for (long long(i) = (0); (i) < (n); (i)++) {
    if (a[i] < x) res += llabs(a[i] - x);
  }
  for (long long(i) = (0); (i) < (m); (i)++) {
    if (b[i] > x) res += llabs(b[i] - x);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  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];
  long long le = 1, ri = 1e9;
  while (llabs(ri - le) > 3) {
    long long m1 = le + (ri - le) / 3;
    long long m2 = ri - (ri - le) / 3;
    if (f(m1) < f(m2))
      ri = m2;
    else
      le = m1;
  }
  long long ans = 1e18;
  for (long long(x) = (le); (x) < (ri + 1); (x)++) {
    ans = min(ans, f(x));
  }
  cout << ans << endl;
  return 0;
}
