#include <bits/stdc++.h>
using namespace std;
template <class T>
T sq(T x) {
  return x * x;
}
const long long inf = 2147383647;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;
const long long maxint = 2147483647;
const long long minint = -2147483648;
int n, m;
long long arr[100010], brr[100010];
long long dp1[100010], dp2[100010];
void input() {
  int i;
  for (i = 0; i < n; i++) {
    scanf("%I64d", &arr[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%I64d", &brr[i]);
  }
  sort(arr, arr + n);
  sort(brr, brr + m);
}
void dpcalc() {
  dp1[0] = 0;
  int i;
  for (i = 1; i < n; i++) {
    dp1[i] = dp1[i - 1];
    dp1[i] += i * (arr[i] - arr[i - 1]);
  }
  dp2[m - 1] = 0;
  for (i = m - 2; i >= 0; i--) {
    dp2[i] = dp2[i + 1];
    int e = m - i - 1;
    dp2[i] += e * (brr[i + 1] - brr[i]);
  }
}
long long findCost(long long x) {
  long long res = 0;
  long long pos = upper_bound(arr, arr + n, x) - arr;
  if (pos > 0) {
    pos--;
    res += dp1[pos];
    res += (pos + 1) * (x - arr[pos]);
  }
  pos = lower_bound(brr, brr + m, x) - brr;
  if (pos < m) {
    res += dp2[pos];
    res += (m - pos) * (brr[pos] - x);
  }
  return res;
}
int main() {
  scanf("%d %d", &n, &m);
  int i, j;
  input();
  dpcalc();
  long long low = 1, high = 1000000000;
  long long res = -1;
  while (high - low > 5) {
    long long m1 = (2 * low + high) / 3;
    long long m2 = (low + 2 * high) / 3;
    long long u = findCost(m1);
    long long v = findCost(m2);
    if (res == -1) res = u;
    res = min(res, u);
    res = min(res, v);
    if (u > v) {
      low = m1 + 1;
    } else {
      high = m2 - 1;
    }
  }
  while (low <= high) {
    res = min(res, findCost(low));
    low++;
  }
  printf("%I64d\n", res);
  return 0;
}
