#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int a[100010], b[100010];
long long f(int n, int m, int x) {
  long long res = 0;
  for (int(i) = 0; (i) < (n); ++(i)) {
    if (a[i] < x) res += x - a[i];
  }
  for (int(i) = 0; (i) < (m); ++(i)) {
    if (b[i] > x) res += b[i] - x;
  }
  return res;
}
int main() {
  int n, m;
  long long ans = 1000000000 * 1ll * 1000000000;
  scanf("%d%d", &n, &m);
  int l = 0, r = 0;
  for (int(i) = 0; (i) < (n); ++(i)) scanf("%d", &a[i]), r = max(r, a[i]);
  for (int(i) = 0; (i) < (m); ++(i)) scanf("%d", &b[i]), r = max(r, b[i]);
  for (int(it) = 0; (it) < (100); ++(it)) {
    int m1 = l + (r - l) / 3;
    int m2 = r - (r - l) / 3;
    long long s1 = f(n, m, m1), s2 = f(n, m, m2);
    ans = min(ans, min(s1, s2));
    if (s1 > s2) {
      l = m1;
    } else
      r = m2;
  }
  printf("%I64d\n", ans);
  return 0;
}
