#!/bin/python import sys def cost(a, l, r): aa = a[l:r + 1] return reduce(lambda a, b: a | b, aa) - reduce(lambda a, b: a & b, aa) - max(aa) + min(aa) def costlyIntervals(n, k, A): res = [-1] * n for l in xrange(n): for r in xrange(l+1, n): if cost(A, l, r) >= k: for idx in xrange(l, r + 1): res[idx] = max(res[idx], r - l + 1) return res if __name__ == "__main__": n, k = raw_input().strip().split(' ') n, k = [int(n), int(k)] A = map(int, raw_input().strip().split(' ')) result = costlyIntervals(n, k, A) print "\n".join(map(str, result))