#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 3e5 + 5;
int n, k;
int t[N], b[N];
long long check(int x) {
  vector<int> v;
  for (int i = 0; i < n; i++)
    if (b[i] >= x) v.push_back(t[i]);
  sort(v.rbegin(), v.rend());
  long long ans = 0;
  for (int i = 0; i < min((int)v.size(), k); i++) ans += v[i];
  return ans * x;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> t[i] >> b[i];
  int low = 1, high = 1e6, mid1, mid2;
  long long ans;
  while (low <= high) {
    mid1 = low + (high - low) / 3;
    mid2 = high - (high - low) / 3;
    long long x1 = check(mid1), x2 = check(mid2);
    if (x1 >= x2)
      high = mid2 - 1, ans = x1;
    else
      low = mid1 + 1, ans = x2;
  }
  cout << ans;
  return 0;
}
