import Control.Monad(replicateM)
import Data.List(sort)
main = do
    [n,x] <- map read . words <$> getLine
    d <- map read . words <$> getLine :: IO [Int]
    let f a ac = if sum(ac) >= x then ac else a:ac
    let fn = foldr f [] (sort d)
    print $ length fn