#include <bits/stdc++.h>
using namespace std;
long long n, m, a[200005], b[200005], sum1[200005], sum2[200005];
void sum() {
  for (long long i = 0; i < n; i++) {
    if (i > 0) sum1[i] = sum1[i - 1];
    sum1[i] += a[i];
  }
  sum2[m] = 0;
  for (long long i = m - 1; i >= 0; i--) {
    sum2[i] = sum2[i + 1];
    sum2[i] += b[i];
  }
}
int main() {
  long long i, j;
  vector<long long> v;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    v.push_back(a[i]);
  }
  for (i = 0; i < m; i++) cin >> b[i], v.push_back(b[i]);
  sort(a, a + n);
  sort(b, b + m);
  long long val = 100000000000000000;
  sum();
  for (i = 0; i < v.size(); i++) {
    long long ans = 0;
    long long low = lower_bound(a, a + n, v[i]) - a;
    if (low == 0) {
    } else
      ans = (low) * (v[i]) - sum1[low - 1];
    long long high = upper_bound(b, b + m, v[i]) - b;
    if (high == m) {
    } else
      ans += sum2[high] - (m - high) * v[i];
    val = min(val, ans);
  }
  cout << val;
  return 0;
}
