ko_no_lzx_da @ 2021-10-21 08:01:11
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;
int n,m,a[90000000],book[90000000],minn=999999999;
int main(){
cin >>n>>m;
book[0]=0;
for(int i=0;i<n;i++){
minn=999999999;
cin >>a[i];
for(int j=i-1;j>=i-m;j--){
if(a[j]<minn&&a[j]!=0){
minn=a[j];
}
}
book[i]=minn;
}
for(int i=0;i<n;i++){
if(book[i]==999999999){
book[i]=0;
}
cout <<book[i]<<endl;
}
return 0;
}