#include <bits/stdc++.h>
using namespace std;
struct Song {
  int length;
  int id;
  int beauty;
};
bool operator<(const Song& s1, const Song& s2) {
  if (s1.beauty != s2.beauty) return s1.beauty > s2.beauty;
  if (s1.length != s2.length) return s1.length > s2.length;
  return s1.id < s2.id;
}
Song songs[300000 + 5];
priority_queue<int, vector<int>, greater<int>> length_heap;
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    songs[i].id = i;
    cin >> songs[i].length >> songs[i].beauty;
  }
  sort(songs, songs + n);
  long long max_score = 0;
  long long klength = 0;
  int i, j;
  for (i = 0; i < n; i = j) {
    int b = songs[i].beauty;
    for (j = i; j < n && songs[j].beauty == b; ++j) {
      int l = songs[j].length;
      if (length_heap.size() < k) {
        klength += l;
        length_heap.push(l);
      } else if (length_heap.top() < l) {
        klength -= length_heap.top();
        klength += l;
        length_heap.pop();
        length_heap.push(l);
      }
      long long curr_score = b * klength;
      if (curr_score > max_score) {
        max_score = curr_score;
      }
    }
  }
  cout << max_score << endl;
}
