#include <bits/stdc++.h>
double const EPS = 3e-8;
using namespace std;
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
template <class T>
inline T bigmod(T p, T e, T M) {
  if (e == 0) return 1;
  if (e % 2 == 0) {
    long long t = bigmod(p, e / 2, M);
    return (T)((t * t) % M);
  }
  return (T)((long long)bigmod(p, e - 1, M) * (long long)p) % M;
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline bool read(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
const int maxn = 111111;
long long a[maxn], b[maxn], n, m, mini, maxi;
long long check(long long x) {
  int sz = max(n, m);
  int i;
  long long ans = 0;
  for (i = 0; i < sz; i++) {
    if (i < n && x > a[i]) {
      ans += x - a[i];
    }
    if (i < m && b[i] > x) ans += (b[i] - x);
  }
  return ans;
}
int main() {
  int i;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0)
      mini = a[i];
    else if (mini > a[i])
      mini = a[i];
  }
  for (i = 0; i < m; i++) {
    cin >> b[i];
    if (i == 0)
      maxi = b[i];
    else if (maxi < b[i])
      maxi = b[i];
  }
  if (mini >= maxi) {
    cout << 0 << endl;
    return 0;
  }
  long long low = mini, high = maxi, midleft, midright, d1, d2;
  long long res = 1e18;
  for (i = 0; i < 300; i++) {
    midleft = low + (high - low) / 3;
    midright = high - (high - low) / 3;
    d1 = check(midleft);
    d2 = check(midright);
    if (d1 > d2)
      low = midleft;
    else
      high = midright;
    res = min(res, min(d1, d2));
  }
  long long j;
  cout << res << endl;
  return 0;
}
