#include <bits/stdc++.h>
using namespace std;
long long solve(int *arr_a, int n, int *arr_b, int m, int x) {
  long long op = 0;
  int i = m - 1;
  while (i >= 0 && arr_b[i] > x) {
    op += arr_b[i] - x;
    i--;
  }
  i = 0;
  while (i < n && arr_a[i] < x) {
    op += x - arr_a[i];
    i++;
  }
  return op;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int *arr_a = new int[n];
  int *arr_b = new int[m];
  for (int i = 0; i < n; i++) {
    cin >> arr_a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> arr_b[i];
  }
  sort(arr_a, arr_a + n);
  sort(arr_b, arr_b + m);
  int lo = arr_a[0], hi = arr_b[m - 1];
  if (lo > hi) {
    cout << 0;
    return 0;
  }
  while (lo < hi) {
    int mid13 = lo + (hi - lo) / 3;
    int mid23 = hi - (hi - lo) / 3;
    long long temp1 = solve(arr_a, n, arr_b, m, mid13);
    long long temp2 = solve(arr_a, n, arr_b, m, mid23);
    if (temp1 > temp2) {
      lo = mid13 + 1;
    } else {
      hi = mid23 - 1;
    }
  }
  cout << solve(arr_a, n, arr_b, m, lo);
  return 0;
}
