#include <bits/stdc++.h>
using namespace std;
int k, n;
pair<long long, long long> a[300010];
long long ans;
int reb[1000010];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i].second >> a[i].first;
  }
  sort(a, a + n);
  reverse(a, a + n);
  long long i = 0;
  long long cur = 0;
  long long sum = 0;
  set<int> ss;
  while (i < n) {
    cur = a[i].first;
    while (a[i].first == cur) {
      sum += a[i].second;
      ss.insert(a[i].second);
      reb[a[i].second]++;
      if (ss.size() > k) {
        int z = *ss.begin();
        sum -= z;
        if (reb[z] == 1) {
          reb[z] = 0;
          ss.erase(ss.begin()++);
        } else
          reb[z]--;
      }
      i++;
    }
    ans = max(ans, sum * cur);
  }
  cout << ans << endl;
  return 0;
}
