#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m;
int a[N], b[N];
long long f(long long x) {
  long long ret = 0;
  for (int i = 0; i < n; ++i) {
    ret += max(0ll, x - a[i]);
  }
  for (int i = 0; i < m; ++i) {
    ret += max(0ll, b[i] - x);
  }
  return ret;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", b + i);
  }
  int low = 1, high = 2e9;
  long long res = 1e18;
  while (low <= high) {
    int mid = low + (high - low) / 2;
    res = min(res, min(f(mid), f(mid + 1)));
    if (f(mid) <= f(mid + 1)) {
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  printf("%lld\n", res);
}
