Maximum Sum Subarray of Size K
Find the maximum sum of any contiguous subarray of a fixed size K.
Input format
The first line contains N and K. The second line contains N space-separated integers.
Output format
Print the maximum sum of any contiguous subarray of size K.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
5 3
2 1 5 1 3Expected output
9Example 2
Input
4 2
1 9 1 9Expected output
10