#include <bits/stdc++.h>
using namespace std;
long long int s[100005], s1[100005];
long long int bin_search_min(long long int a[], long long int key,
                             long long int n, long long int s) {
  long long int l = s, r = n - 1, m, d = 0;
  ;
  while (l <= r) {
    m = (l + r) / 2;
    if (a[m] == key) {
      return m;
    }
    if (a[m] > key) {
      r = m - 1;
    }
    if (a[m] < key) {
      l = m + 1;
    }
  }
  return r;
}
long long int bin_search_max(long long int a[], long long int key,
                             long long int n, long long int s) {
  long long int l = s, r = n - 1, m, d = 0;
  ;
  while (l <= r) {
    m = (l + r) / 2;
    if (a[m] == key) {
      return m;
    }
    if (a[m] > key) {
      r = m - 1;
    }
    if (a[m] < key) {
      l = m + 1;
    }
  }
  return l;
}
long long int sum_com(long long int a[], long long int b[], long long int mid,
                      long long int n, long long int m) {
  long long int d = bin_search_min(a, mid, n, 0);
  long long int d1 = bin_search_max(b, mid, m, 0);
  long long int ans1 = mid * (d + 1) - s[d];
  long long int ans2 = s1[m - 1] + b[d1] - s1[d1] - mid * (m - d1);
  return ans1 + ans2;
}
int main() {
  long long int n, m, ans, d, i;
  long long int a[100005];
  long long int b[100005];
  scanf("%lld%lld", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%lld", &d);
    a[i] = d;
  }
  sort(a, a + n);
  for (i = 0; i < n; i++) {
    if (i == 0)
      s[i] = a[i];
    else
      s[i] = a[i] + s[i - 1];
  }
  for (i = 0; i < m; i++) {
    scanf("%lld", &d);
    b[i] = d;
  }
  sort(b, b + m);
  for (i = 0; i < m; i++) {
    if (i == 0)
      s1[i] = b[i];
    else
      s1[i] = b[i] + s1[i - 1];
  }
  long long int l = a[0], r = b[m - 1];
  long long int d1 = 0LL, d2 = 0LL, d3 = 0LL;
  while (l < r) {
    long long int mid = (l + r) / 2;
    d1 = sum_com(a, b, mid, n, m);
    d2 = sum_com(a, b, mid - 1, n, m);
    d3 = sum_com(a, b, mid + 1, n, m);
    if (d2 >= d1 && d3 >= d1)
      break;
    else if (d2 <= d1 && d1 <= d3)
      r = mid - 1;
    else if (d2 >= d1 && d1 >= d3)
      l = mid + 1;
  }
  printf("%lld\n", min(d1, min(d2, d3)));
  return 0;
}
