#Q183. 「一本通 5.5 练习 2」绿色通道
「一本通 5.5 练习 2」绿色通道
Description
The high school math assignment "Green Passage" consists of problems to copy complete, numbered . Copying the -th problem takes minutes. Little Y has decided to spend no more than minutes on this task, so some problems will inevitably be left blank. Each problem must either be fully copied or left entirely blank—partial completion is not allowed. A sequence of consecutively numbered blank problems is called a blank segment, and its length is the number of problems it contains. Naturally, this approach will provoke Teacher Ma's anger, and the longer the longest blank segment, the angrier Teacher Ma will be.
Now, Little Y wants to know which problems he should complete within the minutes to minimize Teacher Ma's anger. Since Little Y is very smart, you only need to tell him the minimum possible length of the longest blank segment; there's no need to output the specific selection of problems.
Input Format
The first line contains two integers, and . The second line contains integers, representing in order.
Output Format
Output a single integer, indicating the minimum possible length of the longest blank segment.
Sample 1
| a | 6 | 4 | 5 | 2 | 5 | 3 | 4 | 5 | 2 | 3 | 4 | 5 | 2 | 3 | 6 | 3 | 5 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Blank? | √ | √ | √ | √ | √ | ||||||||||||
17 11
6 4 5 2 5 3 4 5 2 3 4 5 2 3 6 3 5
3
Constraints & Hints
For of the data, ; For all data, , , and .