#include using namespace std; #define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define rep(i,n) for(ll i=0;i=b;i--) #define ll long long int #define pll pair #define fill(a,x) memset(a,x,sizeof(a)) #define mb make_pair #define pb push_back #define F first #define S second #define M 1000000007 #define sc(x) scanf("%lld",&x) #define scc(x1,x2) scanf("%d%d",&x1,&x2) #define sccc(x1,x2,x3) scanf("%d%d%d",&x1,&x2,&x3) #define pr(x) printf("%lld\n",x) #define dbg(a) std::cerr<<#a<<"="<<(a)<<"\n" #define dbg1(a,b) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n" #define dbg2(a,b,c) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n" #define dbg3(a,b,c,d) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n" #define co cout<<"fuck"<>n>>k; ll a[n+1]; repp(i,1,n) cin>>a[i]; repp(i,1,n) { ll o=a[i],an=a[i],ma=a[i],mi=a[i]; if(k==0) dp[i][i]=1; else dp[i][i]=-1; repp(j,i+1,n) { o|=a[j]; an&=a[j]; ma=max(ma,a[j]); mi=min(mi,a[j]); ll v=(o-an)-(ma-mi); // if(i==5 && j==5) // dbg3(o,an,ma,mi); if(v>=k) dp[i][j]=j-i+1; else dp[i][j]=-1; // dbg3(o,an,ma,mi); } } ll ans[n+1]; repp(i,1,n) ans[i]=-1; // repp(i,1,n) // dbg(ans[i]); ll l,r; //dbg(dp[n-1][n]); repp(i,1,n) { //l=i,r=i; repp(j,1,i) { repp(k,i,n) { ans[i]=max(ans[i],dp[j][k]); // if(i==n) // dbg2(j,k,dp[j][k]); } } } repp(i,1,n) cout<