#include <bits/stdc++.h>
using namespace std;
priority_queue<int> pq;
pair<int, int> mas[400000];
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> mas[i].second >> mas[i].first;
  long long res = 0;
  sort(mas, mas + n);
  long long sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    sum += mas[i].second;
    pq.push(-mas[i].second);
    if (pq.size() > k) {
      sum += pq.top();
      pq.pop();
    }
    long long temp = mas[i].first * (sum);
    res = max(res, temp);
  }
  cout << res << "\n";
  return 0;
}
