#include <bits/stdc++.h>
using namespace std;
vector<int> devu, brother;
int n, m, x;
long long f(long long medio) {
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (devu[i] <= medio)
      ans += abs(medio - devu[i]);
    else
      break;
  }
  for (int i = m - 1; i >= 0; i--) {
    if (brother[i] >= medio)
      ans += abs(medio - brother[i]);
    else
      break;
  }
  return ans;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x;
    devu.push_back(x);
  }
  sort(devu.begin(), devu.end());
  for (int i = 0; i < m; i++) {
    cin >> x;
    brother.push_back(x);
  }
  sort(brother.begin(), brother.end());
  if (devu[0] >= brother[m - 1]) {
    cout << 0 << endl;
    return 0;
  }
  long long L = 0, R = 10000000000, mid1, mid2;
  while ((R - L) > 2) {
    mid1 = ((2 * L) + R) / 3;
    mid2 = ((2 * R) + L) / 3;
    if (f(mid1) >= f(mid2))
      L = mid1;
    else
      R = mid2;
  }
  long long ans = 100000000000000000L;
  for (long long i = L; i <= R; i++) ans = min(ans, f(i));
  cout << ans << endl;
  return 0;
}
