#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
const int MOD = 1e9 + 7;
long long n, m, a[MAX], b[MAX];
long long check(long long mid) {
  long long moves = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < mid)
      moves += mid - a[i];
    else
      break;
  }
  for (int i = 0; i < m; i++) {
    if (b[i] > mid)
      moves += b[i] - mid;
    else
      break;
  }
  return moves;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  sort(b, b + m);
  reverse(b, b + m);
  long long st = 1, en = 1e9, mid, best = 1e18;
  while (st <= en) {
    mid = (st + en) / 2;
    long long c1 = check(mid);
    long long c2 = 1e18, c3 = 1e18;
    if (mid + 1 <= 1e9) c2 = check(mid + 1);
    if (mid - 1) c3 = check(mid - 1);
    best = min({best, c1, c2, c3});
    if (c2 <= c3)
      st = mid + 1;
    else
      en = mid - 1;
  }
  cout << best << endl;
}
