#include using namespace std; // std macros typedef long long ll; typedef pair pii; typedef pair pll; // dereference #define F first #define S second #define pb push_back #define mp make_pair // loops #define rep(i,n) for(int i=0;i=a;--i) #define all(X) (X).begin(), (X).end() // I/O #define sd(n) scanf("%d",&n) #define sd2(x,y) scanf("%d%d",&x,&y) #define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z) #define sll(n) scanf("%lld",&n) #define sll2(x,y) scanf("%lld%lld",&x,&y) #define sll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z) #define ss(s) scanf("%s",s) // debug #define debug(x) cerr<<"debug->"<<#x<<"::"<0){ if(b&1) x=(x*y)%c; y=(y*y)%c; b/=2; } return x%c; } int dx[]={0,-1,0,1}; int dy[]={-1,0,1,0};//clockwise from left int dr[]={1,1,0,-1,-1,-1, 0, 1}; int dc[]={0,1,1, 1, 0,-1,-1,-1};//anticlockwise from down const int N = 1e5+5; ll A[N],R[N],L[N]; int main() { ll n,k; sll2(n,k); REP(i,1,n) { sll(A[i]); } REP(i,1,n) { REP(j,1,i) { REP(l,i,n) { ll cost = 0,ao = 0,aa = 0,mx = 0,mn = 0; REP(m,j,l) { if(m == j) { ao = aa = mx = mn = A[m]; } else { ao|=A[m]; aa&=A[m]; mx = max(mx,A[m]); mn = min(mn,A[m]); } } cost = (ao-aa)-(mx-mn); if(cost>=k) { R[i] = max(R[i],1LL*(l-j+1)); } } } if(R[i] == 0) R[i] = -1; printf("%lld\n",R[i]); } return 0; }