#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 100100;
ll n, k, ans = 0;
bool srt(pair<ll, ll> p1, pair<ll, ll> p2) {
  if (p1.first == p2.first) return p1.second < p2.second;
  return p1.first < p2.first;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  vector<pair<ll, ll>> p(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> p[i].second >> p[i].first;
  }
  p[0].first = 0, p[0].second = 0;
  sort(p.begin(), p.end(), srt);
  ll sum[n + 5];
  sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + p[i].second;
  }
  for (int i = 1; i <= n; i++) {
    int ind = min(n, i + k - 1);
    ll temp = p[i].first * (sum[ind] - sum[i - 1]);
    ans = max(ans, temp);
  }
  cout << ans;
  return 0;
}
