#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  vector<pair<long long, long long> > vp;
  for (int i = 0; i < n; ++i) {
    long long x, y;
    scanf("%I64d %I64d", &x, &y);
    vp.push_back({y, x});
  }
  if (k == 1) {
    long long ans = 0ll;
    for (int i = 0; i < n; ++i) ans = max(ans, vp[i].first * vp[i].second);
    return cout << ans << "\n", 0;
  }
  sort(vp.begin(), vp.end());
  priority_queue<long long, vector<long long>, greater<long long> > q;
  long long sum = 0ll;
  int cnt = 0;
  int last;
  long long ans = 0ll;
  for (int i = n - 1; i >= 0; --i) {
    last = i;
    cnt++;
    sum += vp[i].second;
    ans = max(ans, sum * vp[i].first);
    q.push(vp[i].second);
    if (cnt == k - 1) break;
  }
  for (int i = last - 1; i >= 0; --i) {
    long long now = sum + vp[i].second;
    ans = max(ans, now * vp[i].first);
    long long x = q.top();
    if (vp[i].second > x) {
      sum -= x;
      sum += vp[i].second;
      q.pop();
      q.push(vp[i].second);
    }
  }
  return cout << ans << "\n", 0;
}
