#include <bits/stdc++.h>
using namespace std;
inline bool is_palindrome(const string& s) {
  return std::equal(s.begin(), s.end(), s.rbegin());
}
const long long MOD = 1000000007;
const long long INF = 1e9 + 5;
const double eps = 1e-7;
const double PI = acos(-1.0);
inline void debug_vi(vector<int> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
inline void debug_vll(vector<long long> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
const int N = 3e5 + 5;
int n, k;
pair<long long, long long> music[N];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    cin >> music[i].second >> music[i].first;
  }
  sort(music, music + n);
  set<long long> s;
  long long cumsum = 0, ans = 0;
  for (long long i = (long long)(n - 1); i >= (long long)(0); i--) {
    long long cb = music[i].first;
    ans = max(ans, cb * (cumsum + music[i].second));
    if (s.size() == k - 1) {
      auto itr = s.begin();
      if (*itr < music[i].second) {
        cumsum -= *itr;
        s.erase(itr);
        s.insert(music[i].second);
        cumsum += music[i].second;
      }
    } else {
      s.insert(music[i].second);
      cumsum += music[i].second;
    }
  }
  cout << ans;
  return 0;
}
