#!/bin/python import sys def costlyIntervals(n, k, A): c=[-1]*n b=[[0 for _ in xrange(n)] for _ in xrange(n)] p,g=0,1 for i in xrange(n): for j in xrange(i+1,n): b[i][j]=reduce(lambda p,q:p|q, A[i:j+1])-reduce(lambda p,q:p&q, A[i:j+1])-max(A[i:j+1])+min(A[i:j+1]) if b[i][j]>=k: c[i],c[j]=max(c[i],abs(i-j)+1),max(c[j],abs(i-j)+1) return c 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))