#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a[n], b[m], currsuma = 0, currsumb = 0;
  set<long long> distinct;
  map<long long, long long> validxa, validxb, idxsuma, idxsumb;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (long long i = 0; i < n; ++i) {
    currsuma += a[i];
    distinct.insert(a[i]);
    validxa.insert(make_pair(a[i], i));
    idxsuma.insert(make_pair(i, currsuma));
  }
  for (long long i = 0; i < m; ++i) {
    cin >> b[i];
  }
  sort(b, b + m);
  for (long long i = 0; i < m; ++i) {
    distinct.insert(b[i]);
    validxb.insert(make_pair(b[i], i));
  }
  for (long long i = m - 1; i >= 0; --i) {
    currsumb += b[i];
    idxsumb.insert(make_pair(i, currsumb));
  }
  set<long long>::iterator it;
  long long ans = LLONG_MAX, localans = 0;
  for (it = distinct.begin(); it != distinct.end(); ++it) {
    map<long long, long long>::iterator idxa = validxa.lower_bound(*it);
    if (idxa == validxa.end()) {
      idxa->second = n - 1;
    } else {
      while (idxa->first > *it && idxa != validxa.begin()) --idxa;
    }
    map<long long, long long>::iterator suma =
        idxsuma.lower_bound(idxa->second);
    localans = (*it) * (idxa->second + 1) - suma->second;
    map<long long, long long>::iterator idxb = validxb.lower_bound(*it);
    if (idxb == validxb.end()) {
      idxb->second = m - 1;
    }
    map<long long, long long>::iterator sumb =
        idxsumb.lower_bound(idxb->second);
    localans += sumb->second - (*it) * (m - idxb->second);
    ans = min(ans, localans);
  }
  cout << max(ans, (long long)0);
  return 0;
}
