main=do
 [n,x]<-map read.words<$>getLine :: IO [Int]
 ss<-map read.words<$>getLine :: IO [Int]
 let p=fst$foldl(\a b->if snd a<=x then (fst a+1,snd a+b) else a)(0,0)ss
 print$if sum ss<=x then p+1 else p