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 = (+1) . fromJust $ findIndex (==(a, b)) xs
  where
    (a, b) = maximumBy (\(a, b) (c, d)-> (a + b) `compare` (c + d)) xs
    xs = [(a, b) | a <- scanl' (+) 0 an, b <- scanl' (+) 0 bm, a + b <= k]
