#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, x, y;
  cin >> n >> k;
  vector<pair<long long int, long long int> > v;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(make_pair(y, x));
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  priority_queue<long long int> s;
  priority_queue<long long int> pq;
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    if (i < k) {
      sum = sum + v[i].second;
      pq.push(sum * v[i].first);
      s.push(-v[i].second);
    } else {
      if (v[i].second > -(s.top())) {
        sum = sum + v[i].second + s.top();
        s.pop();
        s.push(-v[i].second);
        pq.push(sum * v[i].first);
      }
    }
  }
  cout << pq.top() << endl;
}
