Geometry


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 nn integers, where the ithith value of the array is a positive integer representing the enjoyment he will gain from solving the ithith 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 kk problems and only wants to do consecutive problems. Given the array of enjoyments aa, what is the largest sum of up to kk consecutive values?

Input Format

The first line of the input will be two integers, nn and kk. The next line of the input will consist of nn integers, representing aa.

Output Format

Output a single integer, the maximum sum of a subarray of aa that is length kk.

Constraints

n≤1e5n \le 1e5

k≤nk \le n

1≤a[i]≤1e31 \le a[i] \le 1e3

Sample Input 1

Input 1
5 3
-999999999  3 1 4 -999999999

Sample Output 1

Output 1
8

Sample Input 2

Input 2
10 4
289 -999999999 648 178 18 213 514 771 350 312

Sample Output 2

Output 2
1947

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.