import sys
sys.setrecursionlimit(4100000)
import heapq
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
f = [int(i) for i in input().split()]
a.sort()
f.sort(reverse=True)

if sum(a) <= k:
    print(0)
else:
    heap = []
    for i in range(n):
        heapq.heappush(heap, (-a[i]*f[i], a[i], f[i]))
    for i in range(k):
        cur,x,y = heapq.heappop(heap)
        x -= 1
        cur = x*y
        heapq.heappush(heap,(-cur,x,y))
    ans = -float('inf')
    for i in range(len(heap)):
        ans = max(-heap[i][0], ans)
    print(ans)