#include <bits/stdc++.h>

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)

using namespace std;
typedef long long int lli;
typedef pair<lli, lli> pll;
typedef pair<int, int> pii;


static bool comp(pii a, pii b){
    int p1 = a.first * a.second, p2 = b.first * b.second;
    return p1 < p2;
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, m, k = 0;
    int a, b;
    scanf("%d %d", &n, &k);

    vector<pii> data, prods;

    for(int i = 0; i < n; i++){
        scanf("%d %d", &a, &b);
        data.pb({a, b});
    }
    sort(data.rbegin(), data.rend(), comp);

    priority_queue <int, vector<int>, greater<>> pq;
    lli s = 0, res = 0;
    int min_b = INT_MAX;

    for(int i = 0; i < n; i++){
//        printf("i %d %d, %d\n", i, data[i].first, data[i].second);
        s += data[i].first;
        pq.push(data[i].first);
        min_b = min(data[i].second, min_b);

        if(pq.size() > k){
            s -= pq.top();
            pq.pop();
        }
        res = max(res, (lli)min_b * s);

//        printf("res %d s %d min_b %d\n", res, s, min_b);
    }

    printf("%lld", res);
}