#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int n, a[1000006];
int main() {
  int m;
  cin >> n >> m;
  pair<int, int> p[1000006];
  for (int i = 0; i < n; i++) cin >> p[i].second >> p[i].first;
  sort(p, p + n);
  long long s = 0;
  long long res = 0;
  priority_queue<int> q;
  for (int i = n - 1; i >= 0; i--) {
    s += p[i].second;
    q.push(-p[i].second);
    if (n - i > m) {
      s += q.top();
      q.pop();
    }
    res = (res > p[i].first * s ? res : p[i].first * s);
  }
  cout << res << endl;
  return 0;
}
