#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<pair<long long, long long>> v(n);
  vector<long long> mx(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> v[i].second >> v[i].first;
    v[i].first *= -1;
  }
  sort(v.begin(), v.end());
  priority_queue<long long, vector<long long>, greater<long long>> pq;
  for (int i = 0; i < k; i++) {
    mx[i + 1] = mx[i] + v[i].second;
    pq.push(v[i].second);
  }
  for (int i = k; i < n; i++) {
    mx[i + 1] = mx[i];
    if (v[i].second > pq.top()) {
      mx[i + 1] -= pq.top();
      mx[i + 1] += v[i].second;
      pq.pop();
      pq.push(v[i].second);
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long now = -v[i].first;
    long long diff = mx[i + 1];
    now *= diff;
    ans = max(ans, now);
  }
  cout << ans, cout << "\n";
  return 0;
}
