#include <bits/stdc++.h>

using namespace std;

#define ll long long

// Should be Accepted (Fast-I/O)

#define EGRY                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);

const int MAX = 1e6 + 5;

void solve()
{
    ll n, k;
    cin >> n >> k;

    vector<ll> a(n), b(n);

    set<ll> prices;

    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        prices.insert(a[i]);
    }

    for (ll i = 0; i < n; i++)
    {
        cin >> b[i];
        prices.insert(b[i]);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    ll max_profit = 0;

    for (auto &price : prices)
    {
        ll happy = a.end() - lower_bound(a.begin(), a.end(), price);
        ll nothing = lower_bound(b.begin(), b.end(), price) - b.begin();
        ll sad = n - happy - nothing;

        if (sad <= k)
        {
            max_profit = max(max_profit, price * (happy + sad));
        }
    }

    cout << max_profit << endl;
}

int main()
{
    EGRY ll t = 1;
    // cin >> t;

    while (t--)
    {
        solve();
    }

    return 0;
}
