import Data.List
main=do
    [n,x]<-map read.words<$>getLine::IO[Int]
    as<-sort.map read.words<$>getLine::IO[Int]
    print $ f 0 x as
f c 0 [] = c
f c _ [] = c-1
f c x (a:as)
    | a<=x = f (c+1) (x-a) as
    | otherwise = c