#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
const int eps = 3;
long long n, m, l, r = 1e9, ans = 1e18, a[N], b[N];
long long f(long long x) {
  long long ans = 0;
  for (int i = 0; i < n; i++)
    if (a[i] < x) ans += x - a[i];
  for (int i = 0; i < m; i++)
    if (b[i] > x) ans += b[i] - x;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  while (r - l >= eps) {
    long long m1 = l + (r - l) / 3;
    long long m2 = r - (r - l) / 3;
    if (f(m1) > f(m2))
      l = m1;
    else
      r = m2;
  }
  for (long long i = l; i <= r; i++) ans = min(ans, f(i));
  cout << ans;
  return 0;
}
