import Data.List (sort) import Data.Functor ((<$>)) main = do l <- read <$> getLine getLine show . length . fill l . sort . map read . words <$> getLine >>= putStrLn fill l [] = [] fill l (n:ns) | n <= l = n:fill (l-n) ns | otherwise = []