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<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}


template<class T,class Op>
struct QueueAggregation{
	Op op;
	QueueAggregation(const Op &op):op(op){}
	struct Data{
		T val,sum;
		Data(const T &val,const T &sum):val(val),sum(sum){}
	};
	stack<Data>F,B;

	void push(const T &a){
		if(B.empty()){
			B.emplace(a,a);
		}
		else{
			B.emplace(a,op(B.top().sum,a));
		}
	}
	void pop(){
		if(F.empty()){
			F.emplace(B.top().val,B.top().val);
			B.pop();
			while(!B.empty()){
				F.emplace(B.top().val,op(B.top().val,F.top().sum));
				B.pop();
			}
		}
		F.pop();
	}
	T calc(){
		if(F.empty())return B.top().sum;
		if(B.empty())return F.top().sum;
		return op(F.top().sum,B.top().sum);
	}
};

signed main(){
	auto mi=[](int a,int b){return min(a,b);};
	QueueAggregation<int,decltype(mi)>q(mi);

	int N,L;
	scanf("%lld%lld",&N,&L);
	rep(i,L-1){
		int a;scanf("%lld",&a);
		q.push(a);
	}
	vint ans;
	for(int i=L-1;i<N;i++){
		int a;scanf("%lld",&a);
		q.push(a);
		ans.pb(q.calc());
		q.pop();
	}
	rep(i,ans.size()){
		if(i)printf(" ");
		printf("%lld",ans[i]);
	}puts("");
	return 0;
}