Hotels Along the Croatian Coast
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Along the beautiful Adriatic coast, there are hotels. Each hotel has its cost in euros. Petr won euros in the lottery. Now he wants to buy a sequence of consecutive hotels one after another so that the sum of the costs of these consecutive hotels is as large as possible, but does not exceed .
You need to calculate this maximum possible total cost.
Input
The first line contains two integers and . The next line contains positive integers less than , representing the costs of the hotels in the order they are located along the coast.
Output
Print the desired maximum cost (it will be greater than in all tests).
Examples
Input #1
Answer #1
Submissions 2K
Acceptance rate 32%