A Little Cheating Never Hurt Anybody
After finding out the evil plan of cheater Kayaba Akihiko, Kirito caught him and started a duel.
Both of them are extremely overpowered. That's why Kirito will only be able to strike Kayaba once before being evaporated. Kirito has an array of different power-ups. The power of the attack is defined as the maximal subarray sum of the array .
Kayaba is a very experienced cheater, so he knew Kirito's plan. That's why he can perform the following operation times:
choose an index and decrease the value of by one.
Your task is to predict the minimal possible power of Kirito's attack after Kayaba's cheating.
The maximal subarray sum is the maximum sum of values in a contiguous, nonempty subarray. For example, for the array , the subarray from to has the maximum subarray sum, because is the largest sum among all the subarrays.
Input
The first line contains two integers and () — size of the array and the number of operations Kayaba can perform.
The second line contains integers () — elements of the array.
Output
Output a single integer — minimized maximum subarray sum.
Examples
Note
In the first example, Kayaba cannot perform any operations, so the array remains unchanged. Maximal subarray sum will be the sum of the entire array .
In the second example, Kayaba can reduce the value of any element by , and the maximal subarray sum will be .
In the third example, Kayaba can reduce the first and the last element by resulting in the array , where the maximum subarray sum is .
Scoring
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): without additional constraints.