Time limit
1s
Memory limit
128 MB
Hyunsoo measured an integer temperature every day for N days. From this sequence, choose a contiguous period of exactly K days and compute the sum of its temperatures.
Find the maximum possible sum among all contiguous K-day periods.
The first line contains two integers N and K separated by a space. N is the total number of days with temperature measurements, and satisfies 2 <= N <= 100. K is the number of consecutive days to sum, and satisfies 1 <= K <= N.
The second line contains N integers separated by spaces, where each integer is the temperature measured on that day. Each temperature is between -100 and 100, inclusive.
Print the maximum sum of temperatures over any contiguous K-day period.