import Control.Applicative
import Data.List

main :: IO ()
main = do
        [n,s] <- map read.words<$>getLine
        list <- map read.words<$>getLine
        printResult $ calcSmallestWindow list s

calcSmallestWindow :: [Int] -> Int -> Maybe Int
calcSmallestWindow list n = isall0.map (smallest n).tails $ list
    where isall0 list' | all (== 0) list' = Nothing
                       | otherwise        = Just $ minimum.filter (/= 0) $ list'

smallest :: Int -> [Int] -> Int
smallest n list = small 0 0 n list

small acc len n []  = 0
small acc len n (x:xs)
    | acc+x < n = small (acc+x) (len+1) n xs
    | acc+x >= n = len+1

printResult Nothing = print 0
printResult (Just n) = print n