n, k = list(map(int, input().split()))

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

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

a = sorted(a)

f = sorted(f)[::-1]





def c(x):

    # x決めると必要な修行回数も決まる

    res = 0

    for O, K in zip(a, f):

        d = max(0, O * K - x)

        res += (d + K - 1) // K

    return res <= k





l = -1

r = 1 << 60

while r - l > 1:

    mid = (l + r) >> 1

    if c(mid):

        r = mid

    else:

        l = mid

print(r)

n, k = list(map(int, input().split()))

a = sorted(map(int, input().split()))

f = sorted(map(int, input().split()))[::-1]



# 成績　Σ{i=1~n}a[i]*f[i]

# a[i]小さいの、f[i]でかいの組み合わせるとよい(交換しても悪化しない)

def c(x):

    need = 0

    for i in range(n):

        if a[i] * f[i] > x:

            # f[i]を何回減らしてx以下にできるか

            diff = a[i] * f[i] - x

            need += 0 - - diff // f[i]

    return need <= k





l = 0

r = 1 << 60



while r != l:

    mid = (l + r) >> 1

    if c(mid):

        r = mid

    else:

        l = mid + 1

print(l)

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a = sorted(a)
f = sorted(f)[::-1]


def c(x):
    # x決めると必要な修行回数も決まる
    res = 0
    for O, K in zip(a, f):
        d = max(0, O * K - x)
        res += (d + K - 1) // K
    return res <= k


l = -1
r = 1 << 60
while r - l > 1:
    mid = (l + r) >> 1
    if c(mid):
        r = mid
    else:
        l = mid
print(r)

n, k = list(map(int, input().split()))
a = sorted(map(int, input().split()))
f = sorted(map(int, input().split()))[::-1]
# 成績　Σ{i=1~n}a[i]*f[i]
# a[i]小さいの、f[i]でかいの組み合わせるとよい(交換しても悪化しない)
def c(x):
    need = 0
    for i in range(n):
        if a[i] * f[i] > x:
            # f[i]を何回減らしてx以下にできるか
            diff = a[i] * f[i] - x
            need += 0 - -diff // f[i]
    return need <= k


l = 0
r = 1 << 60
while r != l:
    mid = (l + r) >> 1
    if c(mid):
        r = mid
    else:
        l = mid + 1
print(l)

-a = list(map(int, input().split())) -f = list(map(int, input().split())) -a = sorted(a) -f = sorted(f)[::-1] +a = sorted(map(int, input().split())) +f = sorted(map(int, input().split()))[::-1] +# 成績　Σ{i=1~n}a[i]*f[i] +# a[i]小さいの、f[i]でかいの組み合わせるとよい(交換しても悪化しない) +def c(x): +    need = 0 +    for i in range(n): +        if a[i] * f[i] > x: +            # f[i]を何回減らしてx以下にできるか +            diff = a[i] * f[i] - x +            need += 0 - -diff // f[i] +    return need <= k -def c(x): -    # x決めると必要な修行回数も決まる -    res = 0 -    for O, K in zip(a, f): -        d = max(0, O * K - x) -        res += (d + K - 1) // K -    return res <= k - - -l = -1 +l = 0 -while r - l > 1: +while r != l: -        l = mid -print(r) +        l = mid + 1 +print(l)