import java.util.*; public class hack_101_4 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int k = scan.nextInt(); int a[] = new int[n+1]; for(int i=1;i<=n;i++) { a[i] = scan.nextInt(); } int ans[] = new int[n+1]; for(int i=1;i<=n;i++) { int M=0; for(int j=1;j<=n;j++) { if(j>i) { int or=0,and=1,max=0,min=10000; for(int l= i;l<=j;l++) { or = or|a[l]; and = and&a[l]; if(a[l]>max) max = a[l]; if(a[l]=k) { int size = j-i+1; if(size>M) { M = size; ans[i] = size; ans[j]= size; } } } } } for(int i=1;i<=n;i++) { if(ans[i]==0) ans[i]=-1; } for(int i=1;i<=n;i++) System.out.println(ans[i]); } }