Problem: For a given array $a_1, a_2, a_3, ... , a_N$ of $N$ elements and an integer $L$, find the minimum of each possible sub-arrays with size $L$ and print them from the beginning. For example, for an array $\\{1, 7, 7, 4, 8, 1, 6\\}$ and $L = 3$, the possible sub-arrays with size $L = 3$ includes $\\{1, 7, 7\\}$, $\\{7, 7, 4\\}$, $\\{7, 4, 8\\}$, $\\{4, 8, 1\\}$, $\\{8, 1, 6\\}$ and the minimum of each sub-array is 1, 4, 4, 1, 1 respectively.

Constraints

* $1 \leq N \leq 10^6$
* $1 \leq L \leq 10^6$
* $1 \leq a_i \leq 10^9$
* $L \leq N$

Input

The input is given in the following format.

$N$ $L$
$a_1$ $a_2$ ... $a_N$

Output

Print a sequence of the minimum in a line. Print a space character between adjacent elements.

Example

Input

7 3
1 7 7 4 8 1 6


Output

1 4 4 1 1

Solution (in CPP):

Solution:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define INF 2147483647
//static const double INF = (1 << 31)-1;

int n,l;
double d[4000000];

void update(int k,double a){
	k += n - 1;
	d[k] = a;
	while(k > 0){
		k = (k - 1)/2;
		d[k] = min(d[k*2+1], d[k*2+2]);
	}
}


double query(int a, int b, int k, int l, int r){
	if(r <= a || b <= l){
		return INF;
	}
	else if(a <= l && r <= b){
		return d[k];
	}

	double vl = query(a, b, k*2+1, l, (l + r)/2);
	double vr = query(a, b, k*2+2, (l + r)/2, r);
	return min(vl, vr);
}


double findMin(int a, int b){
	return query(a, b+1, 0, 0, n);
}

int main(){
	vector<double> v;
	int n_;
	cin >> n_ >> l;

	n=1;
	while(n<n_){
		n*=2;
	}
	for(int i = 0;i < n*2-1;i++){
		d[i] = INF;
	}

	double s,x,y;
	for(int i = 0;i < n_;i++){
		cin >> x;
		update(i,x);
	}
	double ans;
	v.clear();
	for(int i = 0;i+l-1 < n_;i++){
		ans = findMin(i,i+l-1);
		v.push_back(ans);
	}

	for(int i = 0;i < n_-l+1;i++){
		if(i == n_-l){
			printf("%.0f\n",v[i]);
		}
		else{
			printf("%.0f ",v[i]);
		}
	}

	return 0;
}