-- {-# OPTIONS_GHC -Wall -Werror #-}

main :: IO()
main = do
  [x,a] <- map (read :: String -> Int) . words <$> getLine
  ls <- map (read :: String -> Int) . words <$> getLine
  print . length . filter (<= x) $ scanl (+) 0 ls
