#include <bits/stdc++.h>
using namespace std;
const long long int N = 3e5 + 5;
const long long int MOD = 1e9 + 7;
const long long int inf = 1e15;
pair<long long int, long long int> arr[N];
long long int sum[N] = {0};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, k;
  cin >> n >> k;
  for (long long int i = 1; i <= n; i += 1) {
    cin >> arr[i].second >> arr[i].first;
    arr[i].second = arr[i].second;
  }
  sort(arr + 1, arr + n + 1);
  sum[0] = 0;
  for (long long int i = 1; i <= n; i += 1) {
    sum[i] = sum[i - 1] + arr[i].second;
  }
  long long int ans = -inf;
  multiset<long long int> s;
  long long int sum = 0;
  for (long long int i = n; i >= 1; i--) {
    ans = max(ans, (sum + arr[i].second) * arr[i].first);
    sum += arr[i].second;
    if ((long long int)s.size() > k - 1) {
      auto it = s.lower_bound(0);
      sum -= (*it);
      s.erase(it);
    }
  }
  cout << ans;
}
