(_,k),*t=[list(map(int,t.split()))for t in open(0)]

A,F=list(map(sorted,t))

o=10**12

g=-1

while o-g>1:

 m,l=o+g>>1,k

 for a,f in zip(A,F[::-1]):l-=max(0,a-m//f)

 if l<0:g=m

 else:o=m

print(o)
from numpy import*

(_,k),*t=[int64(t.split())for t in open(0)]

A,F=list(map(sort,t))

s=sum(A)

l=-1

r=10**12

while r-l>1:

 m=l+r>>1

 if s-sum(minimum(A,m//F[::-1]))>k:l=m

 else:r=m

print(r)
(_, k), *t = [list(map(int, t.split())) for t in open(0)]
A, F = list(map(sorted, t))
o = 10**12
g = -1
while o - g > 1:
    m, l = o + g >> 1, k
    for a, f in zip(A, F[::-1]):
        l -= max(0, a - m // f)
    if l < 0:
        g = m
    else:
        o = m
print(o)

from numpy import *

(_, k), *t = [int64(t.split()) for t in open(0)]
A, F = list(map(sort, t))
s = sum(A)
l = -1
r = 10**12
while r - l > 1:
    m = l + r >> 1
    if s - sum(minimum(A, m // F[::-1])) > k:
        l = m
    else:
        r = m
print(r)

-(_, k), *t = [list(map(int, t.split())) for t in open(0)] -A, F = list(map(sorted, t)) -o = 10**12 -g = -1 -while o - g > 1: -    m, l = o + g >> 1, k -    for a, f in zip(A, F[::-1]): -        l -= max(0, a - m // f) -    if l < 0: -        g = m +from numpy import * + +(_, k), *t = [int64(t.split()) for t in open(0)] +A, F = list(map(sort, t)) +s = sum(A) +l = -1 +r = 10**12 +while r - l > 1: +    m = l + r >> 1 +    if s - sum(minimum(A, m // F[::-1])) > k: +        l = m -        o = m -print(o) +        r = m +print(r)