#include <bits/stdc++.h>
using namespace std;
const long long mxn = 1e6 + 7;
pair<long long, long long> p[mxn];
long long sum, MX;
multiset<long long> s;
int main() {
  long long n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> p[i].second >> p[i].first;
  }
  sort(p + 1, p + n + 1);
  reverse(p + 1, p + n + 1);
  for (int i = 1; i <= n; i++) {
    s.insert(p[i].second);
    sum += p[i].second;
    if (s.size() > m) {
      sum -= *s.begin();
      s.erase(s.begin());
    }
    MX = max(MX, p[i].first * sum);
  }
  cout << MX;
  return 0;
}
