import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (sortBy)

main :: IO ()
main = do
  (n : k : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  as <- sortBy compare . map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  fs <- sortBy (flip compare) . map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    afs = zip as fs
  print (n - k + 1)

search :: Int -> [(Int, Int)] -> Int
search k afs = search' (-1, maximum . map (uncurry (*)) $ afs)
  where
    -- search' :: (Int, Int) -> Int
    search (i, j) | j == succ i = j
                  | check m = search' (i, m)
                  | otherwise = search' (m, j)
      where
        m = (i + j) `div` 2
    -- check :: Int -> [(Int, Int)] -> Bool
    check m = check' k afs
      where
        check' l _ | l < 0 = False
        check' _ [] = True
        check' l ((a, f) : afs') = check' (l - max 0 (a - q)) afs'
          where
            q = m `div` f

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
