module Main where

import qualified Data.ByteString.Char8         as BS
import qualified Data.ByteString.Lazy.Char8    as BSL
import qualified Data.ByteString.Builder       as BSB
import           Data.Char                      ( isSpace )
import           Data.List                      ( unfoldr )
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM
import qualified Data.Vector.Generic           as VG
import qualified Data.Vector.Generic.Mutable   as VGM

main :: IO ()
main = do
  [n, m, k] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  as <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  bs <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let cs = merge as bs 0 0
  print $ length $ takeWhile (<=k) $ scanl1 (+) cs

merge as [] costA costB = as
merge [] bs costA costB = bs
merge (a:as) (b:bs) costA costB =
  if costA+a <= costB+b
    then a : merge as (b:bs) (costA+a) costB
    else b : merge (a:as) bs costA (costB+b)