#include <bits/stdc++.h>
using namespace std;
struct point {
  int x;
  int y;
};
bool operator<(const point &a, const point &b) { return (a.x < b.x); }
int compare(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }
vector<long long int> v, v1;
long long int n, m;
long long int f(long long int value) {
  long long int sum = 0;
  for (int i = 0; i < n; i++)
    if (v[i] < value) sum += (value - v[i]);
  for (long long int i = 0; i < m; i++)
    if (v1[i] > value) sum += (v1[i] - value);
  return sum;
}
int main() {
  cin >> n >> m;
  long long int a[n + m];
  int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    v.push_back(a[i]);
  }
  for (i = 0; i < m; i++) {
    cin >> a[i + n];
    v1.push_back(a[i + n]);
  }
  long long int low = 0, high = 1000000008;
  while (1) {
    long long int mid = (low + high) / 2;
    if (f(mid) <= f(mid + 1) && f(mid) <= f(mid - 1)) {
      cout << f(mid) << endl;
      return 0;
    }
    if (f(mid) < f(mid + 1))
      high = mid;
    else
      low = mid;
  }
  return 0;
}
