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:
#define NDEBUG
#include<deque>
#include<functional>
#include<utility>
#include<cstddef>
#include<cassert>

template<class T,class Container=std::deque<std::pair<T,std::size_t>>, class Compare = std::less<T>>
class SlidingMinimum{
public:
	using container_type = Container;
	using value_compare = Compare;
	using value_type = T;
	using size_type = typename container_type::size_type;
	using const_reference = const T&;
private:
	container_type c;
	value_compare comp;
	size_type s;
public:
	SlidingMinimum(const value_compare &x = value_compare()) :comp(x),s(1){}
	bool empty()const{
		return c.empty();
	}
	const_reference top()const{
		assert(!empty());
		return c.front().first;
	}
	size_type top_index()const{
		assert(!empty());
		return c.front().second - s;
	}
	void push(const value_type &x){
		size_type cnt = 1;
		while (!empty() && comp(x, c.back().first)){
			cnt += c.back().second;
			c.pop_back();
		}
		c.push_back(std::pair<value_type, size_type>(x, cnt));
	}
	void push(value_type &&x){
		size_type cnt = 1;
		while (!empty() && comp(x, c.back().first)){
			cnt += c.back().second;
			c.pop_back();
		}
		c.push_back(std::pair<value_type, size_type>(std::move(x), s));
	}
	void pop(){
		assert(!empty());
		if (c.front().second == s){
			c.pop_front();
			s = 0;
		}
		++s;
	}
	void clear(){
		c.clear();
		s = 1;
	}
};





#include<cstdio>
#include<utility>

int main(){
	using uint = unsigned int;
	uint n, l;
	scanf("%u%u", &n, &l);
	SlidingMinimum<uint> S;
	uint a;
	n -= l;
	while (l--){
		scanf("%u", &a);
		S.push(a);
	}
	printf("%u", S.top());
	while (n--){
		S.pop();
		scanf("%u", &a);
		S.push(a);
		printf(" %u", S.top());
	}
	printf("\n");
	return 0;
}