{-# LANGUAGE ScopedTypeVariables #-}
import Control.Applicative
import Control.Monad
import Data.List
import Text.Printf

solve [] lim tmp ans = ans
solve (arr:arrs) lim tmp ans
    | arr + tmp > lim = ans
    | otherwise = solve arrs lim (arr + tmp) (ans + 1)

main = do
    [_,lim] <- map read . words <$> getLine
    arr <- map read . words <$> getLine
    let answer = solve arr lim 0 1
    print answer
