import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons;
import std.math, std.numeric;
import core.bitop;

alias Pair = Tuple!(int, "val", int, "type");

void main() {
    int w, h; scan(w, h);
    auto p = new Pair[](w + h);
    foreach (i ; 0 .. w + h) {
        int pi; scan(pi);
        if (i < w) {
            p[i] = Pair(pi, 0);
        }
        else {
            p[i] = Pair(pi, 1);
        }
    }
    p.sort!"a.val < b.val"();
    debug {
        writefln("%(%s\n%)", p);
    }

    int[] a = [w + 1, h + 1];
    long ans;
    foreach (i ; 0 .. w + h) {
        ans += 1L * p[i].val * a[p[i].type ^ 1];
        a[p[i].type]--;
        debug {
            writefln("%d * %d = %d", p[i].val, a[p[i].type^1], p[i].val * a[p[i].type^1]);
            writeln(a);
        }
    }
    writeln(ans);
}


void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}
