#C507. Summing Consecutive Segment Sums
Summing Consecutive Segment Sums
Summing Consecutive Segment Sums
You are given an array a of n integers and an integer m. Your task is to create a new array b of length n-m+1 such that each element is the sum of m consecutive elements from a. Formally, for each valid i,
$$b[i] = \sum_{j=0}^{m-1} a[i+j]$$
where indices are 0-indexed. This problem tests your ability to process arrays and use simple sliding window techniques.
inputFormat
The first line of input contains two integers, n and m separated by a space.
The second line contains n space-separated integers representing the array a.
outputFormat
Output a single line containing n-m+1 space-separated integers, which are the elements of array b.
## sample5 3
1 2 3 4 5
6 9 12
</p>