#include <bits/stdc++.h>
using namespace std;
int INF = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<pair<long long, long long>> data1;
  vector<pair<long long, long long>> data2;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    data1.push_back(make_pair(a, b));
  }
  data2 = data1;
  sort(data1.begin(), data1.end(),
       [](pair<long long, long long> lhs, pair<long long, long long> rhs) {
         return lhs.first < rhs.first;
       });
  sort(data2.begin(), data2.end(),
       [](pair<long long, long long> lhs, pair<long long, long long> rhs) {
         return lhs.second < rhs.second;
       });
  reverse(data2.begin(), data2.end());
  priority_queue<long long> mn;
  long long count = 0;
  long long ans = -1;
  for (int i = 0; i < data2.size(); i++) {
    if (i < k) {
      count += data2[i].first;
      mn.push(-1 * data2[i].first);
      ans = max(ans, count * data2[i].second);
    } else {
      if (abs(mn.top()) < data2[i].first) {
        count -= abs(mn.top());
        count += data2[i].first;
        mn.pop();
        mn.push(-1 * data2[i].first);
        ans = max(ans, count * data2[i].second);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
