import Control.Applicative import Data.List main::IO() main = do boxLength <-read <$> getLine blockNum <-read <$> getLine --先頭boxLength個のdataを対象に blockWiS <-fmap (take blockNum . fmap read . words) getLine print . length . takeWhile (<= boxLength) . scanl1 (+) . sort $ blockWiS