#include <iostream>
#include <math.h>
#include <cmath>
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define mp make_pair
#define db double
#define pb push_back
#define ld long double
#define INF INT_MAX
#define mod1 1000000007
#include <string.h>
const int M=1e12;
const int N=1e5+5;
using namespace std;

int max(int a,int b)
{
	if(a>=b)
		return a;
	else
		return b;
}
int min(int a,int b)
{
	if(a<=b)
		return a;
	else
		return b;
}
ll diff(ll a,ll b)
{
    if(a>=b)
        return a-b;
    else
        return b-a;
}
int isPrime(int n)
{
    if(n < 2)
        return 0;
    if(n < 4)
        return 1;
    if(n % 2 == 0 or n % 3 == 0)
        return 0;
    for(int i = 5; i*i <= n; i += 6)
        if(n % i == 0 or n % (i+2) == 0)
            return 0;
    return 1;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

void sort(int arr[],int n){
    for(int i=0;i<=n;i++){
        for(int j=i;j<=n;j++){
            if(arr[i] > arr[j]){
                int t = arr[i];
                arr[i] = arr[j];
                arr[j] = t;
            }
        }
    }

}

int modd(int n,int m){
    if(n-m>0){
        return n-m;
    }
    else{
        return m-n;
    }
}

int fact(int n){
    if(n==1){
        return 1;
    }
    else{
        return n*fact(n-1);
    }
}

int mod(int n){
    if(n>=0){
        return n;
    }
    else{
        return -n;
    }
}

int isperfectsquare(int n){
    int k = sqrt(n);
    if(n%k==0 && n/k==k){
        return 1;
    }
    else{
        return 0;
    }
}


//int a[10]= {1, 5, 8, 9, 6, 7, 3, 4, 2, 0};
// sort(a, a+10); // sorts this array.
//The prototype for sort is sort(startaddress, endaddress);

void pairsort(int a[], int b[], int n)
{
    pair<int, int> pairt[n];
    for (int i = 0; i < n; i++)
    {
        pairt[i].first = a[i];
        pairt[i].second = b[i];
    }
    sort(pairt, pairt + n);
    for (int i = 0; i < n; i++)
    {
        a[i] = pairt[i].first;
        b[i] = pairt[i].second;
    }
}

int ispalindrome(string s){
    int palindrome = 1;
    int n = s.length();
    for(int i=0;i<(n/2);i++){
        if(s[i]!=s[n-1-i]){
            palindrome = 0;
            break;
        }
    }
    return palindrome;
}

//void bfs(int x)
//{
//	v1.push_back(x);
//	for(int i=0;i<v1.size();i++)
//		for(int j=0;j<v[v1[i]].size();j++)
//			if(!vis[v[v1[i]][j]])
//				v1.push_back(v[v1[i]][j]);
//}
int lcm(int a, int b)
{
    return (a*b)/gcd(a, b);
}

string longsum(string n1,string n2){
    string s1 = "";
    string s2 = "";
    int carry = 0;
    int n = min(n1.length(),n2.length());
    if(n1.length()!=n2.length()){
        if(n1.length() == n){
            int diff = n2.length()-n;
            while(diff--){
                s2 += '0';
            }
            for(int i=0;i<n1.length();i++){
                s2 += n1[i];
            }
            n1 = s2;
            s2 = "";
        }
        else{
           int diff = n1.length()-n;
            while(diff--){
                s2 += '0';
            }
            for(int i=0;i<n2.length();i++){
                s2 += n2[i];
            }
            n2 = s2;
            s2 = "";
        }
    }
    int length = max(n1.length(),n2.length());
    for(int i=length-1;i>=0;i--){
        int sum = n1[i]-48 + n2[i]-48 + carry;
        carry = sum/10;
        s1 += (sum%10)+48;
    }
    if(carry){
        s2 += (carry+48);
    }
    for(int i=0;i<length;i++){
        s2 += s1[length-i-1];
    }
    return s2;
}

int lcompstr(string s1,string s2){
    //returns 1 is s1 is higher.
    if(s1.length()!=s2.length()){
        if(s1.length() > s2.length()){
            return 1;
        }
        else{
            return 0;
        }
    }
    else{
        for(int i=0;i<s1.length();i++){
            if(s1[i] > s2[i]){
                return 1;
            }
            else if(s1[i] < s2[i]){
                return 0;
            }
        }
    }
    return 1;
}

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

int modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
    if (g != 1)
        cout << "Inverse doesn't exist";

    int res = (x%m + m) % m;
    return res;
}

void add1(int &a,int b){
    a = a + b;
    if(a >= mod1){
        a = a - mod1;
    }
}

int idb(int i,int j,int k){
    int num = i*100 + j*10 + k;
    if(num%8==0){
        return 1;
    }
    else{
        return 0;
    }
}

int isdiv(int n,int k){
    while(n%k==0){
        n/=k;
    }
    if(n==1){
        return 1;
    }
    else{
        return 0;
    }
}

int binpow(int a,int b){
    int ans = 1;
    while(b!=0){
        //cout << b << " " << (b&1) << "  " << a << endl;
        if(b&1){
            ans = ans*a;
        }
        a = a*a;
        b = b >> 1;
    }
    return ans;
}

int32_t main()
{
    int maxans = 0;
    int n,k;
    cin >> n >> k;
    int a[n],b[n];
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    pairsort(b,a,n);
    int sum[k+1] = {0};
    sum[1] = a[n-1];
    int min1[k+1] = {0};
    min1[1] = b[n-1];
    int minu = b[n-1];
    for(int i=n-2;i>=n-k;i--){
        sum[n-i] = sum[n-i-1] + a[i];
        min1[n-i] = min(minu,b[i]);
    }
    for(int i=1;i<=k;i++){
        int ans = sum[i]*min1[i];
        if(ans > maxans){
            maxans = ans;
        }
    }
    cout << maxans;
    return 0;
}
