import Data.List

readIntList :: IO [Int]
readIntList = map read . words <$> getLine

f :: [Int] -> Int -> Int -> Int
f list count limit
    | sum (take (count + 1) list) < limit = f list (count + 1) limit
    | sum (take (count + 1) list) == limit = count + 1
    | otherwise = count


main = do
    [_, _, k] <- readIntList
    a <- readIntList
    b <- readIntList
    let ab = sort (a ++ b) :: [Int]
    let ret = f ab 0 k
    print ret