#include <bits/stdc++.h>
using namespace std;
bool debug = 1;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
int a[100005], b[100005];
long long sa[100005], sb[100005];
set<int> s;
long long ans = (1LL << 60);
int main() {
  scanf("%d%d", &n, &m);
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    cin >> a[i];
    s.insert(a[i]);
  }
  for (int(j) = 1; (j) <= (int)(m); (j)++) {
    cin >> b[j];
    s.insert(b[j]);
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  for (int(i) = 1; (i) <= (int)(n); (i)++) sa[i] = a[i] + sa[i - 1];
  for (int(j) = 1; (j) <= (int)(m); (j)++) sb[j] = sb[j - 1] + b[j];
  int i = 1, j = 1;
  for (int tar : s) {
    while (i <= n && a[i] < tar) i++;
    long long tmp = (long long)tar * (i - 1) - (sa[i - 1]);
    while (j <= m && b[j] <= tar) j++;
    if (j <= m) {
      tmp += (sb[m] - sb[j - 1]) - (long long)tar * (m - j + 1);
    }
    ans = min(ans, tmp);
  }
  printf("%lld\n", ans);
  return 0;
}
