#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<algorithm>
#include<numeric>

using namespace std;

#define endl                   '\n'
#define gap                    ' '
#define Max                    LLONG_MAX
#define Min                    LLONG_MIN
#define Mod                    1000000007
#define remax(a, b)            a = max(a, b)
#define remin(a, b)            a = min(a, b)
#define PI                     3.1415926535897932384626433832795
#define nps                    string::npos
#define int                    int64_t
#define double                 long double
#define cont(it, s)            for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i, s, n)           for(int i = s; i < n; ++i)
#define repe(i, s, n)          for(int i = s; i <= n; ++i)
#define repr(i, n, s)          for(int i = n; i >= s; --i)
#define read(a)                for(auto& xy : a) cin >> xy
#define speak(a)               for(auto xy : a) cout << xy << ' '; cout << endl
#define work(xy, a)            for(auto& xy : a)
#define dbg(x)                 cerr << (#x) << " is " << (x) << endl
#define all(xy)                (xy).begin(),(xy).end()
#define rall(xy)               (xy).rbegin(),(xy).rend()

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, k;
    cin >> n >> k;
    vector<pair<int, int>> v(n);
    work(x, v) cin >> x.first >> x.second;

    sort(all(v), [&](auto x, auto y) {
        return x.first * x.second > y.first * y.second;
    });

    int ans = v.front().first * v.front().second, sum = v.front().first, value = v.front().second;
    k--;

    rep(i, 1, n) {
        if((sum + v[i].first) * min(value, v[i].second) > ans and k) {
            remin(value, v[i].second);
            sum += v[i].first;
            ans = sum * value;
            k--;
        }
    }

    cout << ans;
}
