import Data.List

count :: Int -> Int -> [Int] -> Int
count 0 x l  = if (0 == x) then 0 else (-1)
count n x l  = if ((head l) <= x)
                  then (+) 1 $ count (n-1) (x-(head l)) (tail l)
                  else 0

main :: IO ()
main = do
  [n,x] <- map read <$> words <$> getLine
  chi <-  map read <$> words <$> getLine
  putStrLn $ show $ count n x (sort chi)