#include <bits/stdc++.h>
using namespace std;
long long n, m, a[100001], b[100001];
long long suma[100001], sumb[100001], ans = 1000000000000000000;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  sort(b, b + m);
  for (long long i = 0; i < n; i++) {
    suma[i] = a[i];
    if (i) suma[i] += suma[i - 1];
  }
  for (long long i = m - 1; i >= 0; i--) {
    sumb[i] = b[i];
    sumb[i] += sumb[i + 1];
  }
  for (long long i = 0; i < n; i++) {
    long long to_a = -suma[i] + a[i] * (i + 1);
    long long ind = lower_bound(b, b + m, a[i]) - b;
    long long from_b = sumb[ind] - a[i] * (m - ind);
    ans = min(ans, to_a + from_b);
  }
  for (long long i = 0; i < m; i++) {
    long long from_b = sumb[i] - b[i] * (m - i);
    long long ind = upper_bound(a, a + n, b[i]) - a - 1;
    if (ind == -1) {
      ans = min(ans, from_b);
      continue;
    }
    long long to_a = b[i] * (ind + 1) - suma[ind];
    ans = min(ans, to_a + from_b);
  }
  cout << ans;
}
