#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
pair<long long int, long long int> p[N];
signed main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k, l, b;
  cin >> n >> k;
  for (int i = 0; i <= n - 1; i++) {
    cin >> l >> b;
    p[i] = make_pair(b, l);
  }
  sort(p, p + n);
  long long int sum = 0;
  multiset<pair<long long int, long long int> > m;
  long long int ans = -1;
  for (long long int i = n - 1; i >= 0; i--) {
    sum += p[i].second;
    m.insert(make_pair(p[i].second, p[i].first));
    while (int((m).size()) > k) {
      long long int val = (*m.begin()).first;
      sum -= val;
      m.erase(m.begin());
    }
    ans = max(ans, sum * p[i].first);
  }
  cout << ans << '\n';
  return 0;
}
