#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  scanf("%lld%lld", &n, &k);
  vector<pair<long long, long long>> p(n);
  for (long long i = 0; i < long long(n); ++i)
    scanf("%lld%lld", &p[i].second, &p[i].first);
  sort(p.rbegin(), p.rend());
  set<long long> s;
  long long sum = 0;
  long long res = 0;
  for (long long i = 0; i < long long(k); ++i) {
    sum += p[i].second;
    res = max(res, sum * p[i].first);
    s.insert(p[i].second);
  }
  for (long long i = k; i < n; ++i) {
    sum += p[i].second;
    sum -= *s.begin();
    s.erase(s.begin());
    s.insert(p[i].second);
    res = max(res, sum * p[i].first);
  }
  printf("%lld\n", res);
}
int main() {
  long long T = 1;
  while (T--) solve();
  return 0;
}
