#include using namespace std; typedef long long ll; typedef pair ii; ll arr[100010]; ll f(ll a,ll b,ll type){ if(type==0)return a|b; if(type==1)return a&b; if(type==2)return max(a,b); return min(a,b); } struct node{ ll s,e; ll ori,andi,maxi,mini; node *l,*r; node(ll a,ll b){ s=a;e=b; if(a==b){ ori=andi=maxi=mini=arr[a]; return; } ll m=(a+b)/2; l=new node(a,m); r=new node(m+1,b); ori=(l->ori)|(r->ori); andi=(l->andi)&(r->andi); maxi=max(l->maxi,r->maxi); mini=min(l->mini,r->mini); } ll query(ll a,ll b,ll type){ if(s==a && b==e){ if(type==0)return ori; if(type==1)return andi; if(type==2)return maxi; return mini; } ll m=(s+e)/2; if(b<=m){ return l->query(a,b,type); } if(mquery(a,b,type); } return f(l->query(a,m,type),r->query(m+1,b,type),type); } ll query(ll a,ll b){ return query(a,b,0)-query(a,b,1)-query(a,b,2)+query(a,b,3); } }; int main() { //freopen("hi.txt","r",stdin); ll n,k; scanf("%lld%lld",&n,&k); for(ll i=0;iquery(0,n-1,0)); //printf("%lld\n",root->query(0,n-1,1)); //printf("%lld\n",root->query(0,n-1,2)); //printf("%lld\n",root->query(0,n-1,3)); ll ans[n]; memset(ans,-1,sizeof(ans)); for(ll i=0;i=k){ hi=j; } } if(hi!=-1){ for(int j=i;j<=hi;j++){ ans[j]=max(ans[j],hi-i+1); } } } for (ll i = 0; i < n; i++) { printf("%lld\n",ans[i]); } }