import Data.List main = do [n,m] <- map read . words <$> getLine cs <- map read . words <$> getLine print $ length $ takeWhile (<=m) $ scanl1 (+) (sort cs)