Forest Fruits

Choose a starting fruit, then walk forward eating each fruit that still fits within capacity C, and report the largest count.

Easy3SimulationBrute forceInterviewNo attempts yetTime limit1sMemory limit64 MB

Problem

Mislav likes spending time outdoors, and he likes forests most of all. The clean air and the pleasant sounds are the reason. He is going to the forest this afternoon, and since he is a practical boy, he plans to fill his stomach along the way. His stomach holds fruit of total weight at most CC.

While walking through the forest he meets mushrooms, chestnuts, berries and other fruits of nature, one after another. The fruits are all of different kinds, and Mislav wants to eat as many of them as he can without overeating. The total weight of the fruits he eats must not exceed CC.

Mislav picks one fruit to start eating at. From that fruit to the last one, he looks at every fruit in the order he meets it: if eating it keeps the total weight at most CC, he eats it, otherwise he walks past it. The fruit he picked to start at is also walked past when it alone already exceeds CC.

You are given the weights of the NN fruits in the order Mislav meets them. Determine the largest number of fruits Mislav can eat.

Input

The first line contains the number of fruits NN and the capacity CC, separated by a space. (1N10001 \le N \le 1000, 1C10000001 \le C \le 1000000)

The second line contains the weights w1,w2,,wNw_1, w_2, \dots, w_N of the fruits in the order Mislav meets them. (1wi10001 \le w_i \le 1000)

Output

Print the largest number of fruits Mislav can eat.

Hint

Take the first example. If Mislav starts at the first fruit, of weight 3, he eats 3, 1 and 1, which is three fruits. If he starts at the second fruit, of weight 1, he eats 1, 2, 1 and 1, which is four fruits.