#!/bin/python import sys def r(A): val = A[0] for i in A[1:]: val = val | i return(val) def a(A): val = A[0] for i in A[1:]: val = val & i return(val) def cost(A): cst = r(A)-a(A)-max(A)+min(A) return(cst) def costlyIntervals(n, k, A): # Return a list of length n consisting of the answers res = [-1 for _ in range(n)] for i in range(1, n+1): for j in range(0, n-i+1): val = A[j : i+j] if(cost(val)>=k): l = len(val) res[j] = res[i+j-1] = l 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))