import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    [n, x] <- fmap read . words <$> getLine :: IO [Int]
    as <- fmap read . words <$> getLine :: IO [Int]
    let bs = filter (<= x) $ scanl1 (+) (sort as)
    case length bs of
        0 -> print 0
        n -> if last bs == x
                then print n
                else print (n - 1)