#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<long long> a(n), b(m);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  long long pre[n + 1], suff[m + 2];
  pre[0] = 0;
  suff[m + 1] = 0;
  for (int i = 0; i < n; i++) pre[i + 1] = pre[i] + a[i];
  for (int i = m - 1; i >= 0; i--) suff[i + 1] = suff[i + 2] + b[i];
  long long ans = 1e18;
  for (int i = m - 1; i >= 0; i--) {
    long long ele = b[i];
    long long sum = suff[i + 1];
    sum -= (m - i) * ele * 1LL;
    long long ind = lower_bound(a.begin(), a.end(), ele) - a.begin();
    sum += ind * b[i] * 1LL - pre[ind];
    ans = min(ans, sum);
  }
  for (int i = 0; i < n; i++) {
    long long ele = a[i];
    long long sum = (i)*ele * 1LL;
    sum -= pre[i];
    long long ind = lower_bound(b.begin(), b.end(), ele + 1) - b.begin();
    sum += suff[ind + 1] - (m - ind) * ele * 1LL;
    ans = min(ans, sum);
  }
  cout << max(ans, 0LL);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
