#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  t = 1;
  for (long long tc = 0; tc < t; tc++) {
    long long n, k;
    cin >> n >> k;
    vector<pair<long long, long long> > arr(n);
    for (long long i1 = 0; i1 < n; i1++) cin >> arr[i1].second >> arr[i1].first;
    sort(arr.begin(), arr.end());
    long long sum = 0, ans = 0;
    set<pair<long long, long long> > st;
    for (long long i = n - 1; i >= 0; i--) {
      st.insert({arr[i].second, i});
      sum += arr[i].second;
      while ((long long)st.size() > k) {
        auto it = st.begin();
        sum -= it->first;
        st.erase(it);
      }
      ans = max(ans, arr[i].first * sum);
    }
    cout << ans << "\n";
  }
  return 0;
}
