/*****   Author MURAD    ******/
/*			 Everyone has a different way of thinking, so God Created us           */
/*			 Hope You Respect My Way..,Thank You ):        */
#include<bits\stdc++.h>
using namespace std;
#include<unordered_set>
#define pi 3.1415926536
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define form(i,m) for(int i=0;i<(int)m;i++)
#define LL long long
#define MP make_pair
#define ff first
# define INF 2147483647
#define _INF -2147483647
#define ss second
#define P_Q priority_queue
#define MM multimap
#define PB push_back
#define ipair pair<int,int>
#define maxx 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define modd 1000000007;
char alphz[27] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
int N, M;
vector<bool>wasHere(2e5 + 5, false);
char keys[27];
vector<int>par;
vector<int>path(300005, INF);
vector<int>dis(100005, INF);
int save[501][501];
list<ipair>adj[300005];
pair<int, ipair > krusk[300005];
int id[300005];
bool visited[300005];
LL gcd(LL a, LL b) {
	if (a == 0)
		return b;
	if (b == 0)
		return a;
	if (a == b)
		return a;
	if (a > b)
		return gcd(a - b, b);
	return gcd(a, b - a);
}
int Mor_power(LL x, LL y)
{
	LL temp;
	if (y == 0)
		return 1;
	temp = Mor_power(x, y / 2);
	if (y % 2 == 0)
		return temp*temp;
	else
		return x*temp*temp;
}
bool checkprime(int N) {
	bool prime = true;
	for (long long i = 2; i * i <= N; i++) {
		if (N % i == 0) {
			prime = false;
			break;
		}
	}
	return prime;
}
int prime_rang(int n,int len)
{
	int c = 0;
	for (int i = 1; i <= n; i++)
	{
		if (checkprime(i)&&i*i<=len)
			c=i;
	}
	return c;
}
void dijjkstra(int src, int n) {
	P_Q<ipair, vector<ipair>, greater<ipair>>pq;
	vector<int>dis(100005, INF);
	pq.push(MP(0, 1));
	dis[src] = 0;
	while (!pq.empty())
	{
		int u = pq.top().ss;
		visited[u] = true;
		pq.pop();
		list<ipair>::iterator i;
		for (i = adj[u].begin(); i != adj[u].end(); i++)
		{
			int v = i->ff;
			int we = i->ss;
			if (!visited[v] && dis[v] > dis[u] + we)
			{
dis[v] = dis[u] + we;
pq.push(MP(dis[v], v));
path[v] = u;
			}
		}
	}
	if (dis[n] == INF)
	{
		cout << -1 << endl;
		return;
	}
	//printpath(n);
}
bool check_plin(string s)
{
	for (int i = 0, j = s.length() - 1; i < s.length() && j >= 0 && j>i; i++, j--) {
		if (s[i] != s[j])
		{
			return false;
		}
	}
	return true;
}
int prim(int s, int v)
{
	int mincost = 0;
	vector<int>parent(300005, -1);
	vector<int>key(300005, INF);
	vector<bool>Inmset(300005, false);
	P_Q<ipair, vector<ipair>, greater<ipair>>pq;
	key[s] = 0;
	pq.push(MP(0, s));
	while (!pq.empty())
	{
		int u = pq.top().ss;
		pq.pop();
		Inmset[u] = true;
		for (auto i = adj[u].begin(); i != adj[u].end(); i++)
		{
			int v = i->ff;
			int cost = i->ss;
			if (Inmset[v] == false && key[v] > cost)
			{
				key[v] = cost;
				mincost += cost;
				pq.push(MP(key[v], v));
				parent[v] = u;
			}
		}
	}
	return mincost;
}
void initialize_kruskal()
{
	for (int i = 0; i < 3e5 + 5; i++)
		id[i] = i;
}
inline int root(int x)
{
	while (id[x] != x)
	{
		id[x] = id[id[x]];
		x = id[x];
	}
	return x;
}
inline void _union(int x, int y) {
	int p = root(x);
	int q = root(y);
	id[p] = id[q];
}
int krs(pair<int, ipair>p[], int s, int e)
{
	int x, y, mincost = 0, cost = 0;
	for (int i = 0; i < e; i++)
	{
		x = p[i].ss.ff;
		y = p[i].ss.ss;
		cost = p[i].ff;
		if (root(x) != root(y))
		{
			mincost += cost;
			_union(x, y);
			par.PB(x);
			//par.pb(y);
		}
	}
	return mincost;
}
LL MMIN(LL a, LL b)
{
	if (a <= b)
		return a;
	else
		return b;
}
LL MMAX(LL a, LL b) {
	if (a >= b)
		return a;
	else
		return b;
}
pair<int, ipair>a[300005];
int main()
{
	El3zba;
	int n, k;
	cin >> n >> k;
	LL l, b;
	for (int i = 0; i < n; i++)
	{
		cin >> l >> b;
		int x = abs(l- b);
		a[i].ff = x;
		a[i].ss.ff = l;
		a[i].ss.ss = b;
	}
	sort(a, a + 300005,greater<>());
	LL sum = 0;LL MIN = INF;
	LL ans = 0;
	for (int i = n-1; i >=0&&k>0; i--)
	{
		sum += a[i].ss.ff;
		MIN = MMIN(MIN, a[i].ss.ss);
		ans = MMAX(ans, sum*MIN);
		k--;
	}
	cout << ans << endl;
	return 0;
}