import math

(n,k),a,f = [list(map(int, s.split())) for s in open(0)]



a.sort()

f.sort(reverse=True)



low = 0

high = 0

for x, y in zip(a,f):

    high = max(high, x*y)



while high != low:

    test = int((high + low) // 2)

    tmp = 0

    for x, y in zip(a,f):

        tmp += max(0, x - math.floor(test / y))

        if tmp > k:

            low = test + 1

            break

    else:

        high = test

print(high)
(n,k),a,f = [list(map(int, s.split())) for s in open(0)]



a.sort(reverse=True)

f.sort()



low = 0

high = 0

for x, y in zip(a,f):

    high = max(high, x*y)



while high != low:

    test = int((high + low) // 2)

    tmp = 0

    for x, y in zip(a,f):

        tmp += max(0, x - int(test / y))

        if tmp > k:

            low = test + 1

            break

    else:

        high = test

print(high)
import math

(n, k), a, f = [list(map(int, s.split())) for s in open(0)]
a.sort()
f.sort(reverse=True)
low = 0
high = 0
for x, y in zip(a, f):
    high = max(high, x * y)
while high != low:
    test = int((high + low) // 2)
    tmp = 0
    for x, y in zip(a, f):
        tmp += max(0, x - math.floor(test / y))
        if tmp > k:
            low = test + 1
            break
    else:
        high = test
print(high)

(n, k), a, f = [list(map(int, s.split())) for s in open(0)]
a.sort(reverse=True)
f.sort()
low = 0
high = 0
for x, y in zip(a, f):
    high = max(high, x * y)
while high != low:
    test = int((high + low) // 2)
    tmp = 0
    for x, y in zip(a, f):
        tmp += max(0, x - int(test / y))
        if tmp > k:
            low = test + 1
            break
    else:
        high = test
print(high)

-import math - -a.sort() -f.sort(reverse=True) +a.sort(reverse=True) +f.sort() -        tmp += max(0, x - math.floor(test / y)) +        tmp += max(0, x - int(test / y))