#include using namespace std; #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout); #define ll long long int #define FF first #define SS second #define mp make_pair #define pb push_back #define pii pair #define pll pair #define sd(x) scanf("%d",&x) #define slld(x) scanf("%lld",&x) #define pd(x) printf("%d\n",x) #define plld(x) printf("%lld\n",x) #define pss printf #define MOD 1000000007 #define INF 1e18 #define eps 0.00001 #define endl '\n' #define debug(n1) cout<qur[100005]; ll tree[400005]; ll lazy[400005]; void lazify(ll s,ll e,ll i) { if(lazy[i]) { tree[i]=tree[i]+(e-s+1)*lazy[i]; if(s!=e) { lazy[2*i]+=lazy[i]; lazy[2*i+1]+=lazy[i]; } lazy[i]=0; } } void upd(ll l,ll r,ll s,ll e,ll i) { lazify(s,e,i); if(s>r||e=l&&e<=r) { lazy[i]++; lazify(s,e,i); return; } ll mid=(s+e)>>1; upd(l,r,s,mid,2*i); upd(l,r,mid+1,e,2*i+1); tree[i]=tree[2*i]+tree[2*i+1]; } ll query(ll l,ll r,ll s,ll e,ll i) { if(s>r||e=l&&e<=r)return tree[i]; ll mid=(s+e)>>1; return (query(l,r,s,mid,2*i)+query(l,r,mid+1,e,2*i+1)); } int main() { slld(n);slld(k); for(int i=1;i<=n;i++) slld(a[i]); for(int i=1;i<=n;i++) { ll x=a[i],y=a[i],z=a[i],h=a[i]; ll an=i; for(int j=i-1;j>=1;j--) { x=(x|a[j]); y=(y&a[j]); z=min(z,a[j]); h=max(h,a[j]); if(x-y-(h-z)>=k)an=j; } if(an==i&&k!=0)an=i+1; for(int j=an;j<=i;j++) ans[j]=max(ans[j],i-an+1); } for(int i=1;i<=n;i++) { if(ans[i]==0)ans[i]=-1; pss("%lld\n",ans[i]); } return 0; }