#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
const long long INF = 1e18 + 7;
const long double EPS = 0.1;
long long n, m;
long long a[123456], b[123456];
long long ans(long long x) {
  long long sum = 0;
  for (long long i = 0; i < n; i++)
    if (a[i] < x) sum += x - a[i];
  for (long long i = 0; i < m; i++)
    if (b[i] > x) sum += b[i] - x;
  return sum;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  sort(b, b + n);
  reverse(b, b + n);
  long long left = 0, right = 1e9;
  for (; left < right - 2;) {
    long long m1 = (right - left) / 3 + left;
    long long m2 = right - (right - left) / 3;
    if (ans(m1) < ans(m2))
      right = m2;
    else
      left = m1;
  }
  cout << min(min(ans(left), ans(right)), ans(left + 1));
  return 0;
}
