#include <bits/stdc++.h>
using namespace std;
long long md = 1e9 + 7;
const int N = 200005;
int INF = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  pair<long long, long long> a[300005];
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    a[i] = make_pair(y, x);
  }
  sort(a, a + n);
  long long ans = 0, ans1 = 0;
  multiset<long long> s;
  for (int i = n - 1; i >= n - k; i--) {
    ans1 += a[i].second;
    s.insert(a[i].second);
    ans = max(ans, a[i].first * ans1);
  }
  for (int i = n - k - 1; i >= 0; i--) {
    long long cur = *s.begin();
    if (cur < a[i].second) {
      ans1 -= cur;
      ans1 += a[i].second;
      s.erase(s.begin());
      s.insert(a[i].second);
      ans = max(ans, a[i].first * ans1);
    }
  }
  cout << ans;
  return 0;
}
