#include using namespace std; const int N = 5e3 + 5, inf = (1 << 30); int n, a[N], k; vector < int > add[N], del[N]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n >> k; for(int i = 1; i <= n; i++){ cin >> a[i]; } for(int i = 1; i <= n; i++){ int curor = 0, curand = inf - 1, curmn = inf, curmx = -inf; for(int j = i; j <= n; j++){ curor |= a[j]; curand &= a[j]; curmn = min(curmn, a[j]); curmx = max(curmx, a[j]); int x = (curor - curand) - (curmx - curmn); if(x >= k){ //cout << i << " " << j << " " << x << "\n"; add[i].push_back(j - i + 1); del[j].push_back(j - i + 1); } } } multiset < int > q; for(int i = 1; i <= n; i++){ for(auto it : add[i]){ q.insert(it); } if(q.empty()){ cout << "-1\n"; } else{ cout << *q.rbegin() << "\n"; } for(auto it : del[i]){ q.erase(q.find(it)); } } }