digl=['0','1','2','3','4','5','6','7','8','9']
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
mod = 10 ** 9 + 7
n,k=f()
l=[]
ans=0
for _ in range(n):
    i,j=f()
    l.append([j,i])
l.sort(reverse=True)
sm=0
mn=0
for i in range(k):
    sm+=l[i][1]
    ans=max(ans,sm*l[i][0])
for i in range(n-k):
    sm+=l[i+k][1]
    sm-=l[i][1]
    ans=max(ans,l[i+k][0]*sm)
print(ans)