#include <bits/stdc++.h>
using namespace std;
using lli = long long;
using ld = long double;
mt19937 rnd(time(nullptr));
lli GetResult(vector<lli>& a, vector<lli>& b, lli m) {
  lli result = 0;
  for (lli i = 0; i < a.size(); i++) {
    if (a[i] < m) result += m - a[i];
  }
  for (lli i = 0; i < b.size(); i++) {
    if (b[i] > m) result += b[i] - m;
  }
  return result;
}
inline void Solve() {
  lli n = 0, m = 0;
  cin >> n >> m;
  vector<lli> a(n), b(m);
  for (auto& it : a) cin >> it;
  sort(a.begin(), a.end());
  for (auto& it : b) cin >> it;
  sort(b.begin(), b.end());
  if (a[0] >= b.back()) {
    cout << 0;
    return;
  }
  lli l = 1, r = 1e9;
  for (lli i = 0; i < 200; i++) {
    lli m1 = l + (r - l) / 3;
    lli m2 = r - (r - l) / 3;
    if (GetResult(a, b, m1) > GetResult(a, b, m2))
      l = m1;
    else
      r = m2;
  }
  lli result = min(GetResult(a, b, l - 1),
                   min(GetResult(a, b, l), GetResult(a, b, l + 1)));
  cout << result;
}
signed main() {
  cout << fixed << setprecision(20);
  Solve();
  return 0;
}
