#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
vector<bool> prime(1e6 + 5, true);
void SieveOfEratosthenes(long long int n) {
  prime[0] = false;
  prime[1] = false;
  for (long long unsigned int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long unsigned int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
int Search(string pat, string txt) {
  int n = txt.size();
  int m = pat.size();
  for (int i = 0; i <= n - m; i++) {
    int j;
    for (j = 0; j < m; j++) {
      if (txt[i + j] != pat[j]) {
        break;
      }
    }
    if (j == m) {
      return i;
    }
  }
  return -1;
}
int findFirst(const std::vector<long long int> &array, int key, int low,
              int high) {
  int ans = -1;
  while (low <= high) {
    int mid = low + (high - low) / 2;
    if (key == array[mid]) {
      ans = mid;
      high = mid - 1;
    } else if (key > array[mid])
      low = mid + 1;
    else
      high = mid - 1;
  }
  return ans;
}
int findLast(const std::vector<long long int> &array, int key, int low,
             int high) {
  int ans = -1;
  while (low <= high) {
    int mid = low + (high - low) / 2;
    if (key == array[mid]) {
      ans = mid;
      low = mid + 1;
    } else if (key > array[mid])
      low = mid + 1;
    else
      high = mid - 1;
  }
  return ans;
}
int d, x, y;
void extendedEuclid(int a, int b) {
  if (b == 0) {
    d = 1;
    x = 1;
    y = 0;
  } else {
    extendedEuclid(b, a % b);
    int temp = x;
    x = y;
    y = temp - (a / b) * y;
  }
}
bool isPowerOfTwo(long long int x) { return (x && !(x & (x - 1))); }
int count_one_in_Bin(long long int n) {
  int ans = 0;
  while (n) {
    n = n & (n - 1);
    ans++;
  }
  return ans;
}
int Len_dec(long long int n) {
  int ans = 0;
  while (n > 0) {
    n /= 10;
    ans++;
  }
  return ans;
}
int Len_Bin(long long int n) {
  int ans = 0;
  while (n > 0) {
    n /= 2;
    ans++;
  }
  return ans;
}
bool cmp(pair<int, int> &p1, pair<int, int> &p2) {
  if (p1.second == p2.second) {
    return p1.first < p2.first;
  }
  return p1.second < p2.second;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  for (int tc = 0; tc < t; tc++) {
    int n, k;
    cin >> n >> k;
    vector<pair<int, int> > arr(n + 1);
    vector<long long unsigned int> brr(n + 1), pre(n + 1);
    for (int i1 = 1; i1 <= n; i1++) cin >> arr[i1].first >> arr[i1].second;
    sort(arr.begin(), arr.end(), cmp);
    pre[0] = 0;
    for (int i = 1; i <= n; i++) {
      brr[i] = arr[i].first;
      pre[i] = pre[i - 1] + brr[i];
    }
    long long int sum = 0, mn = 9223372036854775807LL;
    long long unsigned int ans = sum * mn;
    for (int i = 1; i <= n; i++) {
      int j = min(n, i + k - 1);
      long long int sum1 = pre[j] - pre[i - 1];
      long long int temp1 = arr[i].second;
      ans = max(ans, (long long unsigned int)sum1 * temp1);
    }
    cout << ans << endl;
  }
  return 0;
}
