/* AUTHOR:hruday pabbisetty NIT ROURKElA */ #include #include using namespace std; using namespace std::tr1; #define opt ios_base::sync_with_stdio(0) #define lli long long int #define ulli unsigned long long int #define I int #define S string #define D double #define rep(i,a,b) for(i=a;ib;i--) #define in(n) scanf("%lld",&n) #define in2(a,b) scanf("%lld %lld",&a,&b) #define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c) #define out(n) printf("%lld\n",n) #define inu(a) scanf("%lld",&a) #define outu(a) printf("%llu",a) #define ins(s) scanf("%s",&s) #define outs(s) printf("%s",s) #define mod 1000000007 #define inf 100000000000000 typedef long long ll; typedef pair plli; typedef vector vlli; typedef vector vulli; typedef vector vll; typedef vector vs; typedef vector vplli; #define MM(a,x) memset(a,x,sizeof(a)); #define ALL(x) (x).begin(), (x).end() #define P(x) cerr<<"{"#x<<" = "<<(x)<<"}"< "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n"; #define UN(v) sort(ALL(v)), v.resize(unique(ALL(v))-v.begin()) #define mp make_pair #define pb push_back #define f first #define s second #define sz() size() #define nl cout<<"\n" #define MX1 100005 #define MX2 1000005 #define bs binary_search #define lb lower_bound #define ub upper_bound lli dx[]={0,0,-1,1,-1,-1,1,1}; lli dy[]={1,-1,0,0,1,-1,-1,1}; lli power(lli a,lli b) { lli value; if(b==0) { return 1; } else if(b%2==0) { value=power(a,b/2)%mod; return(value*value)%mod; } else { value=power(a,b/2)%mod; return ((a*value)%mod*(value))%mod; } } lli dp[100005]; vplli v; int main() { /* #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif*/ opt; lli n,k,i,j,l; cin>>n>>k; lli a[n+1]; rep(i,1,1+n) { cin>>a[i]; } rep(i,1,1+n) { lli last=-1,or1=a[i],and1=a[i],mini=a[i],maxi=a[i]; rep(j,i,1+n) { or1|=a[j]; and1&=a[j]; maxi=max(maxi,a[j]); mini=min(mini,a[j]); if((or1-and1)-(maxi-mini)>=k) { last=j; } } if(last!=-1) { v.pb(mp(i,last)); } } rep(i,0,v.sz()) { lli sz=v[i].s-v[i].f+1; rep(j,v[i].f,v[i].s+1) { dp[j]=max(dp[j],sz); } } rep(i,1,1+n) { if(!dp[i]) { dp[i]=-1; } cout<