#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k, i, x, y, z, ans = 0, sum = 0;
  cin >> n >> k;
  vector<pair<long long int, long long int> > vi;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    vi.push_back(make_pair(y, x));
  }
  sort(vi.begin(), vi.end());
  sum = 0;
  multiset<long long int> st;
  y = 0;
  for (i = n - 1; i >= 0; i--) {
    x = vi[i].first;
    y = vi[i].second;
    if (st.size() <= k - 1) {
      y += sum;
      ans = max(ans, x * y);
      st.insert(vi[i].second);
      sum += vi[i].second;
    } else {
      z = *(st.begin());
      sum -= z;
      y += sum;
      ans = max(ans, x * y);
      st.erase(z);
      st.insert(vi[i].second);
      sum += vi[i].second;
    }
  }
  cout << ans;
}
