#P2251. 质量检测

质量检测

Description

To check the quality of a total of NN products on a production line, we first assign each product a score AA indicating its quality. Then we compute Qm=min{A1,A2,,Am}Q_m = \min\{A_1, A_2, \cdots, A_m\}, the score of the worst-quality product among the first MM products, and similarly compute the Qm+1Q_{m + 1} for products 22 through M+1M + 1, Qm+2Q_{m + 2} for products 33 through M+2M + 2, ... Finally, compute QnQ_n for products NM+1N - M + 1 through NN. We will further evaluate based on QQ.

Please compute the sequence QQ as quickly as possible.

Input Format

The input contains two lines.

The first line contains two numbers NN and MM, separated by a space, as described above.

The second line contains NN numbers, representing the quality scores of the NN products.

Output Format

Output NM+1N - M + 1 lines.

Lines 11 through NM+1N - M + 1 each contain one number. On line ii, output Qi+M1Q_{i + M - 1}, as described above.

10 4
16 5 6 9 5 13 14 20 8 12

5
5
5
5
5
8
8

Hint

[Constraints]

For 30%30\% of the testdata, N1000N \le 1 000.

For 100%100\% of the testdata, MN105,Ai106M \le N \le 10^5, A_i \le 10^6.

Translated by ChatGPT 5