#K70697. Maximum Sum of K Consecutive Elements
Maximum Sum of K Consecutive Elements
Maximum Sum of K Consecutive Elements
Given an array of integers and an integer \( k \), the objective is to find the maximum possible sum of any \( k \) consecutive elements in the array. This is a classical problem that can be efficiently solved using the sliding window technique.
You are required to read from stdin and output your answer to stdout.
inputFormat
The input consists of two lines:
- The first line contains two space-separated integers \( n \) (the number of elements in the array) and \( k \) (the length of the subarray).
- The second line contains \( n \) space-separated integers representing the array elements.
outputFormat
Print a single integer representing the maximum sum of any \( k \) consecutive elements.
## sample5 2
1 2 3 4 5
9
</p>