#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long int n, k;
    cin >> n >> k;
    vector<pair<long long int, long long int> > v(n);
    for (long long int i = 0; i < n; i++) cin >> v[i].second >> v[i].first;
    sort((v).begin(), (v).end());
    priority_queue<long long int> pq;
    long long int maxi = 0, sm = 0;
    for (long long int i = n - 1; i >= 0; i--) {
      if (k == 1) {
        maxi = max(maxi, v[i].first * v[i].second);
        continue;
      }
      maxi = max(maxi, v[i].first * (sm + v[i].second));
      if (pq.size() < k - 1) {
        pq.push(-v[i].second);
        sm += v[i].second;
      } else {
        if (-pq.top() < v[i].second) {
          sm += v[i].second + pq.top();
          pq.pop();
          pq.push(-v[i].second);
        }
      }
    }
    cout << maxi;
  }
  return 0;
}
