import io, os
input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
import heapq
n,k=mi()
a=[]
for _ in range(n):
    x,y=mi()
    a.append((x,y))
a=sorted(a,key=lambda x:x[1])
h=[]
heapq.heapify(h)
m=0;y=0
##for i in range(n-1,n-k,-1):
##    y+=a[i][0]
##    f=y*a[i][1]
##    m=max(m,f)
c=0;s=0
for i in range(n-1,-1,-1):
    c+=1
    d=a[i][0]+s
    g=a[i][1]
    f=d*g
    m=max(m,f)
    #print(h,s,i)
    heapq.heappush(h,a[i][0]);x=0
    if c >= k:
        x=heapq.heappop(h)
    s=s-x+a[i][0]
        

print(m)
