#!/bin/python3 import sys from functools import reduce def costlyIntervals(n, k, A): res = [-1] * n for i in range(n): for j in range(i + 1, n + 1): a = A[i:j] cmax = max(a) cmin = min(a) cor = reduce(lambda x, y: x | y, a) cand = reduce(lambda x, y: x & y, a) cost = (cor - cand) - (cmax - cmin) #print('#', a, cost) if cost >= k: for ix in range(i, j): res[ix] = max(res[ix], j - i) return res 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)))