import math

N,K=list(map(int,input().split()))

X=[(b,a*b)for a,b in zip(sorted(list(map(int,input().split()))),sorted(list(map(int,input().split())))[::-1])]

m,M,i=0,10**12,1

exec("i,M,m=((i+m)//2,i,m) if sum(math.ceil(max(0,c-i)/b)for b, c in X)<=K else((i+M)//2,M,i);"*50)

print(M)
N,K=list(map(int,input().split()))

X=[(b,a*b)for a,b in zip(sorted(list(map(int,input().split()))),sorted(list(map(int,input().split())))[::-1])]

m,M,i=0,2**40,1

exec("i,M,m=((i+m)//2,i,m) if -sum(min(0,i-c)//b for b, c in X)<=K else((i+M)//2,M,i);"*50)

print(M)
import math

N, K = list(map(int, input().split()))
X = [
    (b, a * b)
    for a, b in zip(
        sorted(list(map(int, input().split()))),
        sorted(list(map(int, input().split())))[::-1],
    )
]
m, M, i = 0, 10**12, 1
exec(
    "i,M,m=((i+m)//2,i,m) if sum(math.ceil(max(0,c-i)/b)for b, c in X)<=K else((i+M)//2,M,i);"
    * 50
)
print(M)

N, K = list(map(int, input().split()))
X = [
    (b, a * b)
    for a, b in zip(
        sorted(list(map(int, input().split()))),
        sorted(list(map(int, input().split())))[::-1],
    )
]
m, M, i = 0, 2**40, 1
exec(
    "i,M,m=((i+m)//2,i,m) if -sum(min(0,i-c)//b for b, c in X)<=K else((i+M)//2,M,i);"
    * 50
)
print(M)

-import math - -m, M, i = 0, 10**12, 1 +m, M, i = 0, 2**40, 1 -    "i,M,m=((i+m)//2,i,m) if sum(math.ceil(max(0,c-i)/b)for b, c in X)<=K else((i+M)//2,M,i);" +    "i,M,m=((i+m)//2,i,m) if -sum(min(0,i-c)//b for b, c in X)<=K else((i+M)//2,M,i);"