#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<pair<long long, long long> > v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int t, b;
    cin >> t >> b;
    v.push_back({b, t});
  }
  sort(v.begin(), v.end());
  long long sum = 0, ans = 0;
  multiset<int> ms;
  for (int i = n - 1; i >= 0; i--) {
    while (ms.size() > k - 1) {
      sum -= *ms.begin();
      ms.erase(ms.begin());
    }
    ms.insert(v[i].second);
    sum += v[i].second;
    ans = max(ans, sum * v[i].first);
  }
  cout << ans;
}
