import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, k] <- getIntList
    as <- sort <$> getIntList
    fs <- reverse . sort <$> getIntList
    print $ solve 0 (maximum (zipWith (*) as fs)) k (zip as fs)

training time k afs = sum (map (train time) afs) <= k
    where train t (x, y) | x * y < t = 0
                         | otherwise = x - (t `div` y)

solve t0 t1 k afs | t0 == t1 = t0
                  | training tn k afs = solve t0 tn k afs
                  | otherwise = solve (tn + 1) t1 k afs
                  where tn = (t0 + t1) `div` 2