#include <bits/stdc++.h>
using namespace std;
long long int getN(long long int sum) {
  sum = sum * 8;
  sum = sqrt(sum + 1) - 1;
  sum /= 2;
  return sum;
}
long long int apSum(long long int n) {
  long long int a = 1, d = 1;
  long long int res = (2 * a + (n - 1) * d) * n;
  res /= 2;
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool isPrime(long long int n) {
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
bool compare(pair<long long int, long long int> p1,
             pair<long long int, long long int> p2) {
  return p1.second > p2.second;
}
void solveKaro() {
  long long int n, k;
  cin >> n >> k;
  vector<pair<long long int, long long int>> arr;
  for (long long int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    arr.push_back({a, b});
  }
  sort(arr.begin(), arr.end(), compare);
  long long int ans = 0, sum = 0;
  priority_queue<long long int, vector<long long int>, greater<long long int>>
      list;
  for (long long int i = 0; i < n;) {
    long long int cnt = 0;
    for (long long int j = i; j < n; j++) {
      if (arr[j].second != arr[i].second) break;
      cnt += 1;
      list.push(arr[j].first);
      sum += arr[j].first;
      if (list.size() > k) {
        sum -= list.top();
        list.pop();
      }
    }
    long long int res = arr[i].second * sum;
    ans = max(ans, res);
    i += cnt;
  }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int tCase = 1;
  while (tCase--) {
    solveKaro();
  }
}
