import           Control.Monad (replicateM)
import           Data.List (findIndex)

main :: IO ()
main = do
  [n, m, k] <- map read . words <$> getLine :: IO [Int]
  [as, bs] <- replicateM 2 $ scanl1 (+) . map read . words <$> getLine
    :: IO [[Int]]
  let ans1 = (maximum . map (length . takeWhile (<= k))) [as, bs]
      ans2 = maximum
        $ (++) [0] -- for empty list
        $ zipWith (+) [1 ..]
        $ (flip map) ((takeWhile (<= k)) as)
        $ \n -> (length . takeWhile (<= k - n)) bs
  print $ max ans1 ans2