#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 1;
const int MOD = 1e9 + 7;
int N, K;
pair<long long, long long> P[MAXN];
multiset<long long> S;
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) scanf("%lld %lld", &P[i].second, &P[i].first);
  sort(P, P + N);
  reverse(P, P + N);
  long long ans = 0;
  long long total = 0;
  for (int i = 0; i < N; i++) {
    total += P[i].second;
    ans = max(ans, total * P[i].first);
    S.insert(P[i].second);
    if (S.size() == K) {
      auto it = S.begin();
      total -= *it;
      S.erase(it);
    }
  }
  printf("%lld", ans);
  printf("\n");
  return 0;
}
