import Data.List

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

f :: [Int] -> Int -> Int -> Int
f (x:xs) count limit
    | limit - x > 0 = f xs (count + 1) (limit - x)
    | limit - x == 0 = count + 1
    | otherwise = count
f [] count limit = count



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