#include <bits/stdc++.h>
using namespace std;
const long long MOD = 2147483647;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  long long ans = LONG_LONG_MAX;
  vector<int> a(n), b(m);
  vector<long long> prefa(n + 1), prefb(m + 1);
  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());
  for (int i = 0; i < n; ++i) prefa[i + 1] = prefa[i] + a[i];
  for (int i = 0; i < m; ++i) prefb[i + 1] = prefb[i] + b[i];
  swap(a, b);
  swap(prefa, prefb);
  swap(n, m);
  for (int i = 0; i < n; ++i) {
    long long curr = 0;
    int ind1 = lower_bound(b.begin(), b.end(), a[i]) - b.begin() - 1;
    if (ind1 != -1) curr = (long long)a[i] * (ind1 + 1) - prefb[ind1 + 1];
    curr += (prefa[n] - prefa[i + 1]) - (long long)a[i] * (n - i - 1);
    ans = min(ans, curr);
  }
  for (int i = 0; i < m; ++i) {
    long long curr = 0;
    int ind1 = upper_bound(a.begin(), a.end(), b[i]) - a.begin();
    if (ind1 != n)
      curr = (prefa[n] - prefa[ind1]) - (long long)b[i] * (n - ind1);
    curr += (long long)b[i] * i - prefb[i];
    ans = min(ans, curr);
  }
  cout << ans;
}
