Problem Description
Josh loves competitive programming and normally gets some enjoyment out of solving problems. However, Josh hates geometry problems, because they make him horribly depressed.
Tonight's Codeforces contest can be modeled as an array of integers, where the value of the array is a positive integer representing the enjoyment he will gain from solving the problem. The exception to this rule is geometry problems, of which there will likely be some. These are represented by the value -999999999.
Josh knows that he only has time for problems and only wants to do consecutive problems. Given the array of enjoyments , what is the largest sum of up to consecutive values?
Input Format
The first line of the input will be two integers, and . The next line of the input will consist of integers, representing .
Output Format
Output a single integer, the maximum sum of a subarray of that is length .
Constraints
Sample Input 1
5 3
-999999999 3 1 4 -999999999
Sample Output 1
8
Sample Input 2
10 4
289 -999999999 648 178 18 213 514 771 350 312
Sample Output 2
1947
Comments