import Data.List
main = do
  nk <- map (read :: String -> Int) . words <$> getLine
  card <- reverse . sort . map (read :: String -> Int) . words <$> getLine
  putStrLn . show . length $ solve 0 (last nk) card

solve :: Int -> Int -> [Int] -> [Int]
solve n k []      = []
solve n k s@(x:xs)
  | n >= k        = solve 0 k s
  | n + sum s < k = s
  | otherwise     = solve (n+x) k xs
