#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<pair<int, int> > V;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    V.push_back({y, x});
  }
  sort(V.begin(), V.end());
  multiset<int> S;
  long long int ans = 0LL;
  long long int sum = 0LL;
  for (int i = n - 1; i >= 0; i--) {
    int beauty = V[i].first;
    int len = V[i].second;
    sum += len;
    S.insert(len);
    int l = 1;
    auto it = S.begin();
    while (S.size() > k) {
      sum -= *it;
      S.erase(it);
      it++;
      if (it == S.end()) {
        break;
      }
    }
    ans = max(ans, 1LL * sum * beauty);
  }
  cout << ans << endl;
  return 0;
}
