#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1e9 + 7;
long long int INF = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k = 0, l = 0, r = 0, m = 0, n, x, y, z, a, b, p = 0,
                      cnt = 0, cnt1 = 0, low, mid, high, ans = 0, clr,
                      maxi = -1, mini = INF, t, q;
  string s;
  cin >> n >> k;
  vector<pair<long long int, long long int> > V;
  multiset<long long int> se;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    V.push_back({y, x});
  }
  sort(V.begin(), V.end());
  b = 0;
  for (i = 0; i < n; i++) {
    l = 0;
    j = n - 1 - i;
    x = V[j].first;
    se.insert(V[j].second);
    ans += V[j].second;
    if (se.size() > k) {
      l = *se.begin();
      se.erase(se.begin());
    }
    ans = ans - l;
    b = x * ans;
    if (b > maxi) maxi = b;
  }
  cout << maxi << endl;
}
