#include <bits/stdc++.h>
using namespace std;
long long Gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return Gcd(b, a % b);
}
long long Max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long Min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
long long findlcm(vector<long long> arr, long long n) {
  long long ans = arr[0];
  for (int i = 1; i < n; i++) ans = (((arr[i] * ans)) / (Gcd(arr[i], ans)));
  return ans;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long a, long long m) {
  long long x, y;
  long long g = gcdExtended(a, m, &x, &y);
  if (g != 1)
    return -1;
  else {
    long long res = (x % m + m) % m;
    return res;
  }
}
vector<long long> primeFactors(long long n) {
  vector<long long> v;
  while (n % 2 == 0) {
    v.push_back(2);
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      v.push_back(i);
      n = n / i;
    }
  }
  if (n > 2) v.push_back(n);
  return v;
}
long long binarySearch(long long arr[], long long l, long long r, long long x) {
  if (r >= l) {
    long long mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    return binarySearch(arr, mid + 1, r, x);
  }
  return -1;
}
vector<long long> shortPath(vector<pair<long long, long long>> v[],
                            long long src, long long V = 0) {
  set<pair<long long, long long>> setds;
  long long sizee = V;
  long long IN = 0x3f3f3f3f;
  vector<long long> dist(sizee, IN);
  setds.insert(make_pair(0, src));
  dist[src] = 0;
  while (!setds.empty()) {
    pair<long long, long long> tmp = *(setds.begin());
    cout << tmp.first << " ";
    setds.erase(setds.begin());
    long long u = tmp.second;
    vector<pair<long long, long long>>::iterator i;
    for (i = v[u].begin(); i != v[u].end(); ++i) {
      long long v = (*i).first;
      long long weight = (*i).second;
      if (dist[v] > dist[u] + weight) {
        if (dist[v] != 0x3f3f3f3f)
          setds.erase(setds.find(make_pair(dist[v], v)));
        dist[v] = dist[u] + weight;
        setds.insert(make_pair(dist[v], v));
      }
    }
  }
  return dist;
}
void dfs(std::vector<long long> v[], long long s, bool visited[]) {
  cout << s + 1 << " ";
  visited[s] = true;
  for (long long i = 0; i < v[s].size(); ++i) {
    if (!visited[v[s][i]]) {
      dfs(v, v[s][i], visited);
    }
  }
}
void bfs(vector<long long> adj[], long long s, bool visited[]) {
  long long ret = 0;
  list<int> queue;
  visited[s] = true;
  queue.push_back(s);
  list<int>::iterator i;
  vector<long long>::iterator j;
  while (!queue.empty()) {
    s = queue.front();
    cout << s + 1 << " ";
    ret++;
    queue.pop_front();
    for (j = adj[s].begin(); j != adj[s].end(); ++j) {
      if (!visited[*j]) {
        visited[*j] = true;
        queue.push_back(*j);
      }
    }
  }
}
void printgraph(std::vector<long long> v[], long long n) {
  for (long long i = 0; i < n; i++) {
    for (auto l = v[i].begin(); l != v[i].end(); l++) {
      cout << i << " " << *l << endl;
    }
  }
}
void printvector(std::vector<long long> v) {
  for (auto i = v.begin(); i != v.end(); i++) cout << *i << " ";
  cout << "" << endl;
}
void printarray(long long arr[], long long n) {
  for (long long i = 0; i < n; i++) cout << arr[i] << " ";
  cout << "" << endl;
}
void printarray(double arr[], long long n) {
  for (long long i = 0; i < n; i++) cout << arr[i] << " ";
  cout << "" << endl;
}
void printarray(bool arr[], long long n) {
  for (long long i = 0; i < n; i++) cout << arr[i] << " ";
  cout << "" << endl;
}
void weightedgraph(std::vector<pair<long long, long long>> v[], long long n) {
  for (long long i = 0; i < n; i++) {
    for (auto j = v[i].begin(); j != v[i].end(); j++) {
      cout << i << " " << (*j).first << " " << (*j).second << endl;
    }
  }
}
void solve() {
  priority_queue<long long, std::vector<long long>, greater<long long>> pq;
  long long n, k;
  cin >> n >> k;
  std::vector<pair<long long, long long>> v;
  long long i, j;
  for (i = 0; i < n; i++) {
    long long l, b;
    cin >> l >> b;
    v.push_back(make_pair(b, l));
  }
  sort(v.begin(), v.end());
  long long sum = 0;
  long long ans = 0;
  for (i = n - 1; i >= 0; i--) {
    sum += v[i].second;
    pq.push(v[i].second);
    while (pq.size() > k) {
      long long top = pq.top();
      pq.pop();
      sum -= top;
    }
    ans = Max(ans, sum * v[i].first);
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
