# Let's die! :) def cost(A): o = a = mx = mn = A[0] for i in range(1,len(A)): x = A[i] o |= x a &= x mx = max(x,mx) mn = min(x,mn) return (o-a) - (mx-mn) def costlyIntervals(n, k, A): maxlen = [-1]*len(A) for l in range(len(A)): for r in range(l+1,len(A)): #print((A[l:r+1]), cost(A[l:r+1])) if cost(A[l:r+1]) >= k: for i in range(l,r+1): maxlen[i] = max(maxlen[i], r-l+1) return maxlen if __name__ == "__main__": n, k = input().strip().split(' ') n, k = [int(n), int(k)] A = list(map(int, input().strip().split(' '))) result = costlyIntervals(n, k, A) print ("\n".join(map(str, result)))