#include <stdio.h>
#define N 100000
int main(void){
    int i,j;
    int n,l;
    int a[N];
    int min;
    int minnum=-1;
    scanf("%d%d",&n,&l);
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(i=0;i<=n-l;i++)
    {
        if(minnum>=i)
        {
            if(a[minnum]<a[i+l-1]) min=a[minnum];
            else 
            {
                min=a[i+l-1];
                minnum=i+l-1;
            }
        }
        else
        {
            min=a[i];
            for(j=1;j<l;j++)
            {
               if(a[i+j]<=min)
               {
                   min=a[i+j];
                   minnum=i+j;
               }
            }
        }
        printf("%d ",min);
    }
    printf("\n");
    return 0;
}
