#include <bits/stdc++.h>
using namespace std;
void afficher_tab(string s, int tab[], int n) {
  cout << "\n" << s << endl;
  for (int i = 1; i <= n; i++) {
    printf("%d ", tab[i]);
  }
  printf("\n");
}
typedef struct couple {
  int val, b, ind;
} COUPLE;
void affiche_cpl(COUPLE tab[], int n) {
  for (int i = 1; i <= n; i++) {
    printf("%d %d,  ", tab[i].val, tab[i].b);
  }
  printf("\n");
}
bool compare_val(COUPLE c1, COUPLE c2) {
  return c1.val < c2.val || (c1.val == c2.val && c1.b < c2.b);
}
bool compare_b(COUPLE c1, COUPLE c2) {
  return c1.b < c2.b || (c1.b == c2.b && c1.val < c2.val);
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  COUPLE tab[n + 5];
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &tab[i].val, &tab[i].b);
    tab[i].ind = i;
  }
  int greatest_ind[n + 5];
  sort(tab + 1, tab + n + 1, compare_val);
  for (int i = 1; i <= n; i++) {
    greatest_ind[n + 1 - i] = tab[i].ind;
  }
  int position[n + 5];
  sort(tab + 1, tab + 1 + n, compare_b);
  for (int i = 1; i <= n; i++) {
    position[tab[i].ind] = i;
  }
  set<int> next;
  set<int>::iterator it;
  int somme[n + 5];
  memset(somme, 0, sizeof(somme));
  int card[n + 5];
  memset(card, 0, sizeof(card));
  int max_inserted = 0;
  for (int i = 1; i <= n; i++) {
    int p = position[greatest_ind[i]];
    somme[p] = tab[p].val;
    card[p] = 1;
    if (p < max_inserted) {
      it = next.upper_bound(p);
      somme[p] += somme[*it];
      card[p] += card[*it];
    }
    if (card[p] < k) {
      next.insert(p);
      max_inserted = max(max_inserted, p);
    }
  }
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, somme[i] * 1LL * tab[i].b);
  }
  printf("%lld", ans);
}
