Steward runs the greenhouse at the mountain city of Highreach. Today the books show a list of ledgers, and the numbers must be worked out before sundown. Task: For every contiguous window of length k, print the maximum. Input format: First line: n and k. Second line: n integers. Output format: Print n-k+1 maxima space-separated. Constraints: 1 <= k <= n <= 4000; -10^9 <= a[i] <= 10^9.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= k <= n <= 4000; -10^9 <= a[i] <= 10^9.
