main :: IO ()
main = do
    [_, _, k] <- map read . words <$> getLine
    as <- map read . words <$> getLine
    ys <- map read . words <$> getLine
    putStrLn $ show $ eval as ys k
        where
            eval _      _      0 = 0
            eval []     []     _ = 0
            eval (x:xs) []     n = if x <= n then 1 + eval xs [] (n - x) else 0
            eval []     (y:ys) n = if y <= n then 1 + eval [] ys (n - y) else 0
            eval (x:xs) (y:ys) n
                | x <= y    = if x <= n then 1 + eval xs     (y:ys) (n - x) else 0
                | otherwise = if y <= n then 1 + eval (x:xs) ys     (n - y) else 0