#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long _INF = 0xc0c0c0c0c0c0c0c0;
const long long mod = (int)1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long ksm(long long a, long long b, long long mod) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long inv2(long long a, long long mod) { return ksm(a, mod - 2, mod); }
const int MAX_N = 300025;
int n, m;
long long minn[MAX_N], sum[MAX_N];
struct node {
  long long a, b;
} arr[MAX_N];
struct data {
  long long a, id;
  bool operator<(const data other) const { return a > other.a; }
} b[MAX_N];
int main() {
  memset(minn, 0x3f, sizeof(minn));
  scanf("%d%d", &n, &m);
  long long ans = 0;
  for (int i = 1; i <= n; ++i)
    scanf("%lld%lld", &arr[i].a, &arr[i].b), b[i].a = arr[i].a * arr[i].b,
                                             b[i].id = i;
  sort(b + 1, b + 1 + n);
  for (int i = 1; i <= n; ++i)
    minn[i] = min(minn[i], arr[b[i].id].b),
    sum[i] = sum[i - 1] + arr[b[i].id].a;
  for (int i = 1; i <= m; ++i) {
    ans = max(ans, minn[i] * sum[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
