Codeforces Round 171 (Div. 2)
B
Books
Codeforces
1400
原题
← AC →
翻译中…

When Valera has got some free time, he goes to the library to read some books. Today he's got $*t*$ free minutes to read. That's why Valera took $*n*$ books in the library and for each book he estimated the time he is going to need to read it. Let's number the books by integers from 1 to $*n*$. Valera needs $*a*_{*i*}$ minutes to read the $*i*$-th book.

翻译中…

Valera decided to choose an arbitrary book with number $*i*$ and read the books one by one, starting from this book. In other words, he will first read book number $*i*$, then book number $*i* + 1$, then book number $*i* + 2$ and so on. He continues the process until he either runs out of the free time or finishes reading the $*n*$-th book. Valera reads each book up to the end, that is, he doesn't start reading the book if he doesn't have enough free time to finish reading it.

翻译中…

Print the maximum number of books Valera can read.

翻译中…

Input

翻译中…

The first line contains two integers $*n*$ and $*t*$ $(1 ≤ *n* ≤ 10^{5}; 1 ≤ *t* ≤ 10^{9})$ — the number of books and the number of free minutes Valera's got. The second line contains a sequence of $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ $(1 ≤ *a*_{*i*} ≤ 10^{4})$, where number $*a*_{*i*}$ shows the number of minutes that the boy needs to read the $*i*$-th book.

翻译中…

Output

翻译中…

Print a single integer — the maximum number of books Valera can read.

翻译中…

样例

Input #1
4 5
3 1 2 1
Output #1
3
InputCopy OutputCopy
Input #2
3 3
2 2 3
Output #2
1
InputCopy OutputCopy
题目信息
题号
279B
时间限制
2 s
内存限制
256 MB
标签
二分
暴力
模拟
双指针

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。