A turbine emits n vibration readings in order. To flag instability, a monitor slides a window of exactly k consecutive readings and, for each window position, computes the range: the maximum reading minus the minimum reading within that window.
Output the range of every contiguous window of size k, from the leftmost window to the rightmost.
Input format
Line 1: two integers n and k.
Line 2: n space-separated integers, the vibration readings.
Output format
One line with n - k + 1 space-separated integers: the range (max minus min) of each window, left to right.
Constraints
- 1 <= k <= n <= 100000
- -1000000000 <= each reading <= 1000000000