#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
const long long INF = 1e18 + 7;
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
long long MOD(long long a) { return ((a % INF) + INF) % INF; }
long long inv(long long a) { return poww(a, INF - 2, INF); }
int a[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  vector<pair<long long, long long> > vec;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    long long c, d;
    cin >> c >> d;
    vec.push_back({d, c});
  }
  sort(vec.begin(), vec.end());
  long long maxs = 0, sums = 0;
  multiset<long long> s;
  for (int i = n - 1; i >= 0; --i) {
    maxs = max(maxs, (sums + vec[i].second) * vec[i].first);
    s.insert(vec[i].second);
    sums += vec[i].second;
    while (s.size() > k - 1) sums -= *s.begin(), s.erase(s.begin());
  }
  cout << maxs;
}
