#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
int n, k;
pair<int, int> second[300005];
priority_queue<int, vector<int>, greater<int> > pq;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < (signed)(n); i++) {
    cin >> second[i].second >> second[i].first;
  }
  sort(second, second + n, greater<pair<int, int> >());
  long long mx = 0;
  long long sm = 0;
  for (int i = 0; i < (signed)(n); i++) {
    pq.push(second[i].second);
    sm += second[i].second;
    while (pq.size() > k) {
      int top = pq.top();
      pq.pop();
      sm -= (long long)top;
    }
    long long ans = 1LL * second[i].first * sm;
    mx = max(mx, ans);
  }
  cout << mx << "\n";
  return 0;
}
