#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long int n, m, i, num, count = 0, min = 0, max = 1e10, min_count,
                              max_count;
  cin >> n >> m;
  map<long long int, long long int> m1, m2;
  map<long long int, long long int>::iterator it1;
  map<long long int, long long int>::reverse_iterator it2;
  for (i = 0; i < n; i++) {
    cin >> num;
    m1[num]++;
  }
  for (i = 0; i < m; i++) {
    cin >> num;
    m2[num]++;
  }
  it1 = m1.begin();
  it2 = m2.rbegin();
  min = it1->first;
  min_count = it1->second;
  max = it2->first;
  max_count = it2->second;
  while (min < max) {
    if (min_count <= max_count) {
      if (it1->first == m1.rbegin()->first) {
        count += (max - min) * min_count;
        break;
      }
      ++it1;
      num = it1->first;
      if (num < max) {
        count += (num - min) * min_count;
        m1[num] += min_count;
      } else {
        count += (max - min) * min_count;
        m1[max] += min_count;
      }
      m1.erase(m1.find(min));
    } else {
      if (it2->first == m2.begin()->first) {
        count += (max - min) * max_count;
        break;
      }
      ++it2;
      num = it2->first;
      if (num > min) {
        count += (max - num) * max_count;
        m2[num] += max_count;
      } else {
        count += (max - min) * max_count;
        m2[min] += max_count;
      }
      m2.erase(m2.find(max));
    }
    it1 = m1.begin();
    it2 = m2.rbegin();
    min = it1->first;
    min_count = it1->second;
    max = it2->first;
    max_count = it2->second;
  }
  cout << count << endl;
  return 0;
}
