#include <bits/stdc++.h>
void File_IO() {}
using namespace std;
vector<pair<int, int> > song;
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.second == b.second) return a.first > b.first;
  return a.second < b.second;
}
int main() {
  File_IO();
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    song.push_back({a, b});
  }
  sort(song.begin(), song.end(), cmp);
  priority_queue<int> pq, sq;
  for (int i = 0; i < n; i++) {
    sq.push(song[i].first);
  }
  long long sum = 0;
  for (int i = 0; i < k; i++) {
    pq.push(sq.top());
    sum += sq.top();
    sq.pop();
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, song[i].second * sum);
    sum -= song[i].first;
    if (!sq.empty()) {
      sum += sq.top();
      sq.pop();
    }
  }
  cout << ans << endl;
}
