#include <iostream>
#include <cstdint>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
    cin.tie(0);
    
	int64_t W, H;
	cin >> W >> H;
	vector<int64_t> P(W + H);
	for (int64_t i = 0, x; i < W + H; i++)
		cin >> x, P[i] = ((x << 1) | (i < W));
	sort(P.begin(), P.end());
	int64_t r = 0;
	int64_t wh[2] = {W + 1, H + 1};
	for (auto p : P) {
		int64_t t = p & 1;
		r += (p >> 1) * wh[t];
		wh[!t]--;
	}
	cout << r << endl;
	return 0;
}
