G. Great Plummet
time limit per test
0.5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

In the stock market, we like to analyse the change in price within some time intervals. Sometimes, it may provide insights for us to predict the price trends. In this task, you are required to analyse every ($$$M + 1$$$)-day interval over the $$$N + 1$$$ days of the market.

The $$$N$$$ changes in prices between days are given. Let $$$P_i$$$ be the stock price of Day $$$i$$$, $$$A_i$$$ denoted the change $$$P_{i + 1} - P_{i}$$$.

We are interested in finding the maximum continuous decline in the stock price at some time intervals. For each $$$1 \leq i \leq N$$$, we want to find that for the interval of last $$$M$$$ values up to $$$A_i$$$, i.e. the range $$$max(1, i - M + 1)$$$ to $$$i$$$ (inclusive) in $$$A$$$.

For example, if we are considering the interval with $$$7$$$ values $$$[-3, -5, 2, -3, -2, -2, 4]$$$. There are $$$2$$$ ranges of continuous decline, which are $$$[-3, -5]$$$ and $$$[-3, -2, -2]$$$. The sum of the first range evaluates to $$$-8$$$, and the sum of the second range evaluates to $$$-7$$$. Since the magnitude of $$$-8$$$ is larger than $$$-7$$$, the maximum continuous decline of this interval is $$$-8$$$.

If the interval only contains non-negative numbers, the maximum continuous decline should be considered as $$$0$$$.

Please find the answers to all intervals, $$$max(1, i - M + 1)$$$ to $$$i$$$ (inclusive) for all $$$1 \leq i \leq N$$$.

Input

The first line contain $$$2$$$ integers, $$$N$$$ and $$$M$$$.

The second line contains $$$N$$$ integers, $$$A_1, A_2, \dots, A_N$$$.

$$$1 \leq M \leq N \leq 10^5$$$.

$$$-10^9 \leq A_i \leq 10^9$$$.

Output

On the first line output $$$N$$$ integers, the $$$i$$$-th integer representing the required answer to the interval $$$[max(1, i - M + 1), i]$$$ of $$$A$$$.

Examples
Input
10 4
4 -3 1 -2 -3 2 0 -1 -1 -2
Output
0 -3 -3 -3 -5 -5 -5 -3 -2 -4
Input
12 7
-3 -7 -1 -3 -5 6 -3 -2 -2 4 -1 2
Output
-3 -10 -11 -14 -19 -19 -19 -16 -9 -8 -7 -7