CF279B.Books

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

When Valera has got some free time, he goes to the library to read some books. Today he's got tt free minutes to read. That's why Valera took nn 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 nn . Valera needs aia_{i} minutes to read the ii -th book.

Valera decided to choose an arbitrary book with number ii and read the books one by one, starting from this book. In other words, he will first read book number ii , then book number i+1i+1 , then book number i+2i+2 and so on. He continues the process until he either runs out of the free time or finishes reading the nn -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.

输入格式

The first line contains two integers nn and tt (1<=n<=105; 1<=t<=109)(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 nn integers a1,a2,...,ana_{1},a_{2},...,a_{n} (1<=ai<=104)(1<=a_{i}<=10^{4}) , where number aia_{i} shows the number of minutes that the boy needs to read the ii -th book.

输出格式

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

输入输出样例

  • 输入#1

    4 5
    3 1 2 1
    

    输出#1

    3
    
  • 输入#2

    3 3
    2 2 3
    

    输出#2

    1
    
首页