#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const double pi = acos(-1.0);
const int Max = 100010;
const int INF = 1000000007;
long long num1[Max];
long long num2[Max];
int n, m;
long long f(int middle) {
  if (middle < 0) return 0x3FFFFFFFFFFFFFFF;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (num1[i] < middle) ans += middle - num1[i];
  }
  for (int i = 0; i < m; i++)
    if (num2[i] > middle) ans += num2[i] - middle;
  return ans;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%I64d", num1 + i);
  for (int i = 0; i < m; i++) scanf("%dI64", num2 + i);
  int left = 1, right = 1000000000;
  long long ans = min(f(left), f(right));
  while (left < right) {
    int middle = (left + right) / 2;
    int middleright = (middle + right) / 2;
    long long ans1 = f(middle);
    long long ans2 = f(middleright);
    if (ans1 > ans2)
      left = middle;
    else
      right = middleright;
    ans = min(ans, ans1);
    ans = min(ans, ans2);
  }
  ans = min(ans, f(left + 1));
  ans = min(ans, f(left - 1));
  ans = min(ans, f(right + 1));
  ans = min(ans, f(right - 1));
  cout << ans << endl;
  return 0;
}
