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

A = list(map(int, input().split()))

F = list(map(int, input().split()))



A.sort()

F.sort(reverse=True)



#積をx以下にするために必要な修行回数

def f(x):

    r = 0

    for i in range(N):

        a, f = A[i], F[i]

        m = a * f

        if m > x:

            r += (m - x + f - 1) // f

    return r



under = -1

r = 10**18

while r - under > 1:

    m = (under + r) // 2

    if f(m) > K: under = m

    else: r = m

print(r)
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)

import sys

def main(N, K, A, F):

    A.sort()

    F.sort(reverse=True)



    def f(x):

        sy = 0

        for a, f in zip(A, F):

            m = a * f

            if m > x:

                sy += (m - x + f - 1) // f

        return sy



    under = -1

    hi = 10**12 + 1

    while hi - under > 1:

        m = (hi + under) // 2

        if f(m) <= K: hi = m

        else: under = m

    print(hi)



if __name__ == '__main__':

    input = sys.stdin.readline

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

    *A, = list(map(int, input().split()))

    *F, = list(map(int, input().split()))

    main(N, K, A, F)

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
# 積をx以下にするために必要な修行回数
def f(x):
    r = 0
    for i in range(N):
        a, f = A[i], F[i]
        m = a * f
        if m > x:
            r += (m - x + f - 1) // f
    return r


under = -1
r = 10**18
while r - under > 1:
    m = (under + r) // 2
    if f(m) > K:
        under = m
    else:
        r = m
print(r)

# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys


def main(N, K, A, F):
    A.sort()
    F.sort(reverse=True)

    def f(x):
        sy = 0
        for a, f in zip(A, F):
            m = a * f
            if m > x:
                sy += (m - x + f - 1) // f
        return sy

    under = -1
    hi = 10**12 + 1
    while hi - under > 1:
        m = (hi + under) // 2
        if f(m) <= K:
            hi = m
        else:
            under = m
    print(hi)


if __name__ == "__main__":
    input = sys.stdin.readline
    N, K = list(map(int, input().split()))
    (*A,) = list(map(int, input().split()))
    (*F,) = list(map(int, input().split()))
    main(N, K, A, F)

-N, K = list(map(int, input().split())) -A = list(map(int, input().split())) -F = list(map(int, input().split())) -A.sort() -F.sort(reverse=True) -# 積をx以下にするために必要な修行回数 -def f(x): -    r = 0 -    for i in range(N): -        a, f = A[i], F[i] -        m = a * f -        if m > x: -            r += (m - x + f - 1) // f -    return r +# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) +import sys -under = -1 -r = 10**18 -while r - under > 1: -    m = (under + r) // 2 -    if f(m) > K: -        under = m -    else: -        r = m -print(r) +def main(N, K, A, F): +    A.sort() +    F.sort(reverse=True) + +    def f(x): +        sy = 0 +        for a, f in zip(A, F): +            m = a * f +            if m > x: +                sy += (m - x + f - 1) // f +        return sy + +    under = -1 +    hi = 10**12 + 1 +    while hi - under > 1: +        m = (hi + under) // 2 +        if f(m) <= K: +            hi = m +        else: +            under = m +    print(hi) + + +if __name__ == "__main__": +    input = sys.stdin.readline +    N, K = list(map(int, input().split())) +    (*A,) = list(map(int, input().split())) +    (*F,) = list(map(int, input().split())) +    main(N, K, A, F)