#####################################   
import atexit, io, sys , collections, heapq
buffer = io.BytesIO() 
sys.stdout = buffer
@atexit.register 
def write(): sys.__stdout__.write(buffer.getvalue())   
mod = 998244353
##################################### 
n,k = map(int,raw_input().split())
ais = [map(int, raw_input().split()) for _ in range(n)]
ais.sort(key = lambda x:-x[1])
ans = 0
heap = []
c = 0
for l,b in ais:
	heapq.heappush(heap,l) 
	c += l - (heapq.heappop(heap) if len(heap) == k+1 else 0)
	ans = max(ans, b * c)


print ans