import           Data.List
import           Data.Maybe

main :: IO ()
main = do
    [n, m, k] <- map read . words <$> getLine
    an <- map read . words <$> getLine
    bm <- map read . words <$> getLine
    print $ solve k an bm

solve :: Int -> [Int] -> [Int] -> Int
solve k an bm = fromJust (findIndex (==a) ans) + fromJust (findIndex (==b) bms) + 2
  where
    (a, b) = maximumBy (\(a, b) (c, d)-> (a + b) `compare` (c + d)) xs
    xs = [(a, b) | a <- ans , b <- bms, a + b <= k]
    ans = tail $ scanl' (+) 0 an
    bms = tail $ scanl' (+) 0 bm
