#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename T>
class RangeQuery{
public:
	virtual T CalculateCost(T left,T right)=0;
	virtual void EvaluateElement(T& left,T right)=0;
	virtual void EvaluateLazy(T& left,T right)=0;
	virtual void UpdateLazy(T& left,T right,T vleft,T vright)=0;
};

template<typename T>
class RangeMinimumQuery:public RangeQuery<T>{
public:
	T CalculateCost(T left,T right){return min(left,right);}
	void EvaluateElement(T& left,T right){left=right;}
	void EvaluateLazy(T& left,T right){left=right;}
	void UpdateLazy(T& left,T right,T vleft,T vright){left=right;}
};

template<typename T>
class SegmentTree{
	T def_value;
	int last_num;
	vector<T> element,lazy;
	vector<bool> lazy_flag;
	unique_ptr<RangeQuery<T>> range_query;
public:
	SegmentTree(vector<T>& vec,T def):def_value(def){
		int N=vec.size();
		last_num=1;
		while(last_num<N) last_num <<= 1;
		element.resize(2*last_num-1,def);
		lazy.resize(2*last_num-1,0);
		lazy_flag.resize(2*last_num-1,false);

		range_query = make_unique<RangeMinimumQuery<T>>();

		for(int i=0;i<N;i++){
			element[i+last_num-1] = vec[i];
		}
		for(int i=last_num-2;i>=0;i--){
			element[i] = range_query->CalculateCost(element[2*i+1],element[2*i+2]);
		}
	}
	void Evaluate(int index,int left,int right){
		if(!lazy_flag[index]) return;
		range_query->EvaluateElement(element[index],lazy[index]);
		if(right-left>1){
			range_query->EvaluateLazy(lazy[2*index+1],lazy[index]);
			range_query->EvaluateLazy(lazy[2*index+2],lazy[index]);
			lazy_flag[2*index+1] = lazy_flag[2*index+2] = true;
		}
		lazy[index] = 0;
		lazy_flag[index] = false;
	}
	void UpdateRange(int left,int right,T x,int index=0,int vleft=0,int vright=-1){
		if(vright<0) vright = last_num;
		Evaluate(index,vleft,vright);

		if(vright<=left || right<=vleft) return;
		if(left<=vleft && vright<=right){
			range_query->UpdateLazy(lazy[index],x,vleft,vright);
			lazy_flag[index] = true;
			Evaluate(index,vleft,vright);
		}
		else{
			UpdateRange(left,right,x,2*index+1,vleft,(vleft+vright)/2);
			UpdateRange(left,right,x,2*index+2,(vleft+vright)/2,vright);
			element[index] = range_query->CalculateCost(element[2*index+1],element[2*index+2]);
		}
	}
	// left<right
	T Find(int left,int right,int index=0,int vleft=0,int vright=-1){
		if(vright<0) vright = last_num;
		if(vright<=left || right<=vleft) return def_value;

		Evaluate(index,vleft,vright);
		if(left<=vleft && vright<=right) return element[index];

		T res_left = Find(left,right,2*index+1,vleft,(vleft+vright)/2);
		T res_right = Find(left,right,2*index+2,(vleft+vright)/2,vright);
		return range_query->CalculateCost(res_left,res_right);
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	auto N=in(),Q=in();
	vector<ll> A=vecin<ll>(N);
	SegmentTree<ll> tree(A,(1LL<<60));
	
	REP(i,N-Q+1){
		auto v = tree.Find(i,i+Q);

		if(i) cout << ' ';
		cout << v;
	}
	out();
	return 0;
}



Measured memory_bytes: 43736