#include <bits/stdc++.h>
using namespace std;
int n, m;
long long a[100005], b[100005];
long long first(long long x) {
  long long res = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] < x) res = res + x - a[i];
  for (int i = 1; i <= m; i++)
    if (b[i] > x) res = res + b[i] - x;
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) cin >> b[i];
  long long l = 1, r = 1000000007, m;
  while (l < r) {
    m = (l + r + 1) / 2;
    if (first(m) > first(m - 1))
      r = m - 1;
    else if (first(m) < first(m - 1))
      l = m;
    else
      l = r = m;
  }
  cout << first(l) << endl;
  return 0;
}
