#include <stdio.h>
#include <queue>
#include <utility>
using namespace std;
int main(){
    int n,l,temp;
    priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >pq;
    scanf("%d%d",&n,&l);
    for(int i=0;i<l;i++){
        scanf("%d",&temp);
        pq.push(make_pair(temp,i));
    }
    printf("%d",pq.top().first);
    for(int i=l;i<n;i++){
        scanf("%d",&temp);
        pq.push(make_pair(temp,i));
        while(pq.top().second<=i-l)pq.pop();
        printf(" %d",pq.top().first);
    }
    printf("\n");
}