#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& output, vector<T>& v) {
  output << "[ ";
  if (int(v.size())) {
    output << v[0];
  }
  for (int i = 1; i < int(v.size()); i++) {
    output << ", " << v[i];
  }
  output << " ]";
  return output;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& output, pair<T1, T2>& p) {
  output << "( " << p.first << ", " << p.second << " )";
  return output;
}
template <typename T>
ostream& operator,(ostream& output, T x) {
  output << x << " ";
  return output;
}
int n, m;
long long a[100007], b[100007];
long long sum(long long mid) {
  long long cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < mid) {
      cnt += (mid - a[i]);
    } else {
      break;
    }
  }
  for (int i = m - 1; i > -1; i--) {
    if (b[i] > mid) {
      cnt += (b[i] - mid);
    } else {
      break;
    }
  }
  return cnt;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%lld", &b[i]);
  }
  sort(a, a + n);
  sort(b, b + m);
  long long low = 1, high = 1000000000;
  long long result;
  while (low <= high) {
    long long mid = (low + high) / 2;
    long long p = sum(mid - 1);
    long long q = sum(mid);
    long long r = sum(mid + 1);
    if (q <= p && q <= r) {
      result = q;
      break;
    }
    if (p <= q && q <= r) {
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  cout << result << endl;
}
