#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)1e5 + 5;
int n, a[MAXN], m, b[MAXN];
long long sa[MAXN], sb[MAXN];
set<int> A, B;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &b[i]);
  }
  sort(a, a + n);
  sort(b, b + m);
  for (int i = 0; i < n; i++) {
    sa[i + 1] = sa[i] + a[i];
  }
  for (int i = 0; i < m; i++) {
    sb[i + 1] = sb[i] + b[i];
  }
  long long best = 1ll << 60;
  for (int ti = 0; ti < n; ti++) {
    if (A.count(a[ti])) continue;
    A.insert(a[ti]);
    long long ans = 0;
    ans = 1ll * ti * a[ti] - (sa[ti] - sa[0]);
    int ind = upper_bound(b, b + m, a[ti]) - b;
    ans += sb[m] - sb[ind] - 1ll * (m - ind) * a[ti];
    best = min(best, ans);
  }
  for (int ti = m - 1; ti >= 0; ti--) {
    if (B.count(b[ti])) continue;
    B.insert(b[ti]);
    long long ans = 0;
    ans = sb[m] - sb[ti + 1] - 1ll * (m - ti - 1) * b[ti];
    int ind = lower_bound(a, a + n, b[ti]) - a;
    ans += 1ll * ind * b[ti] - (sa[ind] - sa[0]);
    best = min(best, ans);
  }
  cout << best << endl;
  return 0;
}
