#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using dd = long double;
namespace {
static bool constexpr dbg = 0;
ll constexpr N = 1.1e5;
ll n, m, a[N], b[N];
ll foo(ll k) {
  ll ret = 0;
  for (ll i = 1; i <= (ll)(n); ++i)
    if (a[i] < k) ret += k - a[i];
  for (ll i = 1; i <= (ll)(m); ++i)
    if (b[i] > k) ret += b[i] - k;
  return ret;
}
void init() {
  cin >> n >> m;
  for (ll i = 1; i <= (ll)(n); ++i) cin >> a[i];
  for (ll i = 1; i <= (ll)(m); ++i) cin >> b[i];
}
void solve() {
  ll res = LONG_LONG_MAX, l = 0, r = 1.1e9;
  for (ll _ = 1; _ <= (ll)(100); ++_) {
    ll m1 = l + (r - l) / 3, m2 = l + 2 * (r - l) / 3;
    ll v1 = foo(m1), v2 = foo(m2);
    res = min({res, v1, v2});
    if (v1 < v2)
      r = m2;
    else
      l = m1;
  }
  cout << res;
}
}  // namespace
int main() {
  if (!dbg) {
    std::ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  cout << fixed << setprecision(20);
  init();
  solve();
  return 0;
}
