rrm = lambda: map(int, raw_input().split()) N, K = rrm(); A = rrm() ans = [-1] * N for i, x in enumerate(A): OR = AND = MAX = MIN = x cost = OR-AND -MAX+MIN if cost >= K: ans[i] = max(ans[i], 1) for j in xrange(i+1, len(A)): y = A[j] OR |= y AND &= y MAX = max(MAX, y) MIN = min(MIN, y) cost = OR-AND -MAX+MIN if cost >= K: for k in xrange(i, j+1): ans[k] = max(ans[k], j-i+1) for x in ans: print x