#include <bits/stdc++.h>
using namespace std;
int N, M;
long long V[100005];
long long R[100005];
void read_vector(long long *v, int n) {
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
}
long long distance(long long k) {
  long long dist = 0;
  for (int i = 0; i < N; i++) {
    if (V[i] < k) {
      dist += (k - V[i]);
    }
  }
  for (int i = 0; i < M; i++) {
    if (R[i] > k) {
      dist += (R[i] - k);
    }
  }
  return dist;
}
long long search(long long left, long long right) {
  long long answer = numeric_limits<long long>::max();
  while (left < right) {
    long long left_third = left + (right - left) / 3;
    long long right_third = right - (right - left) / 3;
    long long distance_left_third = distance(left_third);
    long long distance_right_third = distance(right_third);
    answer = min(answer, min(distance_left_third, distance_right_third));
    if (distance_left_third >= distance_right_third) {
      left = left_third + 1;
    } else {
      right = right_third - 1;
    }
  }
  return answer;
}
int main() {
  cin >> N >> M;
  read_vector(V, N);
  read_vector(R, M);
  cout << search(1, 1000000000) << endl;
  return 0;
}
