#K35477. Minimum Sum of k Consecutive Elements

    ID: 25540 Type: Default 1000ms 256MiB

Minimum Sum of k Consecutive Elements

Minimum Sum of k Consecutive Elements

Given an array of integers and an integer \(k\), your task is to find the minimum sum of any \(k\) consecutive elements from the array.

The input consists of two lines. The first line contains two integers \(n\) and \(k\), where \(n\) is the number of elements in the array and \(k\) is the number of consecutive elements to consider. The second line contains \(n\) space-separated integers representing the array elements.

You need to output a single integer representing the minimum sum of any \(k\) consecutive elements. It is guaranteed that \(k \leq n\).

inputFormat

The first line contains two space-separated integers \(n\) and \(k\).
The second line contains \(n\) space-separated integers.

outputFormat

Output a single integer which is the minimum sum of any \(k\) consecutive elements in the given array.

## sample
7 3
10 4 2 5 6 3 8
11