function cost(as, fs) {
    var r = 0;
    var mi = 0;
    for (var i = 0; i < as.length; i++) {
        var _r = as[i] * fs[i]
        if (_r > r) {
            r = _r
            mi = i;
        }
    }
    return [r, mi];
}

function Main(input) {
    var lines = input.trim().split("\n");
    var n = parseInt(lines[0].split(" ")[0]);
    var k = parseInt(lines[0].split(" ")[1]);
    var as = lines[1].split(" ").map(i => parseInt(i)).sort(function(a, b) { return b - a });
    var fs = lines[2].split(" ").map(i => parseInt(i)).sort(function(a, b) { return a - b });

    for (var i = 0; i < k; i++) {
        var rmi = cost(as, fs);
        var r = rmi[0];
        var mi = rmi[1];

        if (r === 0) {
            console.log(0);
            return;
        }
        as[mi]--;
    }

    var rmi = cost(as, fs);
    console.log(rmi[0]);
}

process.stdin.resume();
process.stdin.setEncoding("utf8");
var globalInput = '';
process.stdin.on('data', function(chunk) {
    globalInput += chunk;
})
process.stdin.on('end', function() {
    Main(globalInput)
})

// Main(require("fs").readFileSync("/dev/stdin", "utf8"));