#include<deque>
#include<functional>
#include<utility>
#include<cstddef>
#include<cassert>

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


#include<cstdio>
#include<utility>

int main(){
	int n, l;
	scanf("%d%d", &n, &l);
	SlidingMinimum<int> S;
	int a;
	n -= l;
	while (l--){
		scanf("%d", &a);
		S.push(std::move(a));
	}
	printf("%d", S.top());
	while (n--){
		S.pop();
		scanf("%d", &a);
		S.push(std::move(a));
		printf(" %d", S.top());
	}
	printf("\n");
	return 0;
}





