#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define upper(n,m) (n+m-1)/m
#define rounding(n) (int)((double)n+0.5)

#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(a) a.begin(),a.end()
#define coutALL(i,a) for(auto e:a) cout<<(i++?" ":"")<<e; cout<<endl;

#define deb cout<<"debug"<<endl
#define debn(n) cout<<"debug: "<<n<<endl

//#define int long long

const int MAX=INT_MAX;
const int MOD=(int)1e9+7;
const int EPS=1e-12;
//const int dx[]={0,1,0,-1},dy[]={-1,0,1,0};
const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using namespace std;

typedef pair<int,int> P;
typedef long long LL;

signed main(){

  int n,l;
  cin>>n>>l;

  vector <int> a(n);
  REP(i,n) cin>>a[i];

  multiset <int> a2;
  REP(i,l) a2.insert(a[i]);

  cout<<*a2.begin();

  REP(i,n-l){

    a2.erase(a2.lower_bound(a[i]));
    a2.insert(a[l+i]);

    cout<<" "<<*a2.begin();

  }

  cout<<endl;

  return 0;

}

