#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> ans_ind;
  priority_queue<pair<int, int> > pq;
  int n, k;
  cin >> n >> k;
  k--;
  vector<pair<int, int> > v(n);
  int temp, temp2;
  for (temp = 0; temp < n; temp++) {
    cin >> v[temp].second >> v[temp].first;
  }
  sort(v.begin(), v.end());
  for (temp = 0; temp < n; temp++) {
    pq.push({v[temp].second, temp});
  }
  long long ans = 0;
  long long lensum = 0;
  while (ans_ind.size() < k) {
    pair<int, int> tp = pq.top();
    pq.pop();
    ans_ind.insert(tp.second);
    lensum += tp.first;
  }
  bool illegal[n];
  memset(illegal, 0, sizeof(illegal));
  for (temp = 0; temp < n; temp++) {
    if (ans_ind.find(temp) == ans_ind.end()) {
      illegal[temp] = true;
    } else {
      ans_ind.erase(temp);
      lensum -= v[temp].second;
      while (!pq.empty() && ans_ind.size() < k) {
        pair<int, int> tp = pq.top();
        pq.pop();
        if (illegal[tp.second]) continue;
        lensum += tp.first;
        ans_ind.insert(tp.second);
      }
    }
    ans = max(ans, 1LL * v[temp].first * (lensum + v[temp].second));
  }
  cout << ans << "\n";
}
