#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  unsigned long long n, k, x, y;
  cin >> n >> k;
  vector<pair<unsigned long long, unsigned long long> > s;
  set<unsigned long long> r;
  for (int i = 0; i < n; i++) cin >> x >> y, s.push_back({y, x});
  sort(s.begin(), s.end());
  x = 0;
  y = 0;
  for (int i = n - 1; i >= 0; i--) {
    r.insert(s[i].second);
    x += s[i].second;
    while (r.size() > k) {
      auto j = r.begin();
      x -= *j;
      r.erase(j);
    }
    y = max(y, x * s[i].first);
  }
  cout << y;
  return 0;
}
