#P2032. Sliding Board Maximum

    ID: 15314 Type: Default 1000ms 256MiB

Sliding Board Maximum

Sliding Board Maximum

We are given a 1×n1\times n matrix that contains nn integers. A wooden board, which can cover kk consecutive numbers, is initially placed on the first kk numbers of the matrix. Then, the board is moved one unit to the right repeatedly until its right end coincides with the nthn^{th} element of the matrix. Before each move (including the initial position), output the maximum value among the numbers currently covered by the board.

inputFormat

The first line contains two integers nn and kk (1kn1 \leq k \leq n). The second line contains nn integers representing the matrix values.

outputFormat

Output exactly nk+1n-k+1 lines. Each line should contain a single integer, which is the maximum among the kk numbers covered by the board at that position.

sample

5 3
1 3 2 5 4
3

5 5

</p>