import Data.List

main :: IO ()
main = do
  (n:x:_) <- map read . words <$> getLine :: IO [Int]
  as <- scanl (+) 0 . sort . map read . words <$> getLine
  putStrLn $ show $ subtract 1 $ length $ filter (<= x) as