#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
long long suma[maxn + 5], sumb[maxn + 5];
int a[maxn + 5], b[maxn + 5];
int n, m;
long long ans = 0;
long long getAns(long long x) {
  long long tem = 0;
  int pos = lower_bound(a, a + n, x) - a - 1;
  if (pos >= 0) tem += 1LL * (pos + 1) * x - suma[pos];
  pos = upper_bound(b, b + m, x) - b;
  if (pos >= 1) tem -= sumb[pos - 1];
  tem += sumb[m - 1] - 1LL * (m - pos) * x;
  return tem;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < m; i++) scanf("%d", &b[i]);
  sort(a, a + n);
  sort(b, b + m);
  for (int i = 0; i < n; i++) suma[i] = i == 0 ? a[0] : suma[i - 1] + a[i];
  for (int i = 0; i < m; i++) sumb[i] = i == 0 ? b[0] : sumb[i - 1] + b[i];
  long long l = 1, r = 1e9;
  while (l + 2 < r) {
    long long tem1 = (l + l + r) / 3, tem2 = (l + r + r) / 3;
    long long p1 = getAns(tem1), p2 = getAns(tem2);
    if (p1 > p2) {
      l = tem1;
    } else
      r = tem2;
  }
  if (r >= l) ans = getAns(l);
  if (r >= l + 1) ans = min(ans, getAns(l + 1));
  if (r >= l + 2) ans = min(ans, getAns(l + 2));
  printf("%lld\n", ans);
  return 0;
}
