from functools import reduce from operator import * n, k = map(int, input().split()) arr = list(map(int, input().split())) def cost(l, r): slc = arr[l:r+1] return (reduce(or_, slc) - reduce(and_, slc)) - (max(slc) - min(slc)) costs = [[cost(l, r) for r in range(l, n)] for l in range(n)] def best(i): b = -1 for l in range(i+1): for r in range(i, n): if costs[l][r-l] >= k: b = max(b, r - l + 1) return b for i in range(n): print(best(i))