#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int INF = 2e9;
const long long LINF = 1e18 + 5;
const long long MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int MN = 1e6 + 2;
int a[MAXN];
int b[MAXN];
int n;
int m;
long long f(int x) {
  long long r1 = 0, r2 = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] < x) r1 += x - a[i];
  }
  for (int i = 0; i < m; ++i) {
    if (b[i] > x) r2 += b[i] - x;
  }
  return r1 + r2;
}
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]);
  int lo = -1, hi = 1e9 + 1;
  while (hi - lo > 1) {
    int mid = (lo + hi + 1) / 2;
    if (f(mid) > f(mid + 1))
      lo = mid;
    else
      hi = mid;
    ;
  }
  printf("%lld\n", f(hi));
  return 0;
}
