#include <bits/stdc++.h>
using namespace std;
vector<long long> a, b;
long long n, m;
long long func(long double val) {
  long long x = floor(val);
  long long moves = 0;
  long long i;
  for (i = 0; i < n; i++) {
    if (a[i] < x) {
      moves += x - a[i];
    }
  }
  for (i = 0; i < m; i++) {
    if (b[i] > x) {
      moves += b[i] - x;
    }
  }
  return moves;
}
int main() {
  cin >> n >> m;
  a.resize(n);
  b.resize(m);
  long long i;
  long long mini = 100000000000, maxi = -1;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    mini = min(a[i], mini);
  }
  for (i = 0; i < m; i++) {
    cin >> b[i];
    maxi = max(b[i], maxi);
  }
  long long start = mini;
  long long end = maxi + 1;
  long long moves = 100000000000000000;
  long long mid1, mid2;
  if (mini >= maxi)
    cout << "0";
  else {
    moves = min(moves, func(mini));
    moves = min(moves, func(maxi));
    moves = min(moves, func(mini + 1));
    while (end - start > 2) {
      mid1 = start + (end - start) / 3;
      mid2 = end - (end - start) / 3;
      long long c1 = func(mid1);
      long long c2 = func(mid2);
      moves = min(moves, min(c1, c2));
      if (c1 > c2)
        start = mid1;
      else
        end = mid2;
    }
    cout << moves << endl;
  }
  return 0;
}
