#include using namespace std; vector costlyIntervals(int n, int k, const vector &A) { vector ret(n, -1); vector< vector > cache(n, vector(n)); for(int f = 0; f < n; ++f) { int orr = 0, andd = 0x7FFFFFFF; int mxx = 0, mnn = 0x7FFFFFFF; for(int t = f; t < n; ++t) { const int item = A[t]; orr |= item; andd &= item; mxx = max(mxx, item); mnn = min(mnn, item); cache[f][t] = ((orr - andd + 0LL) - (mxx - mnn) >= k + 0LL) ? 1 : 0; } } for(int id = 0; id < n; ++id) { for(int ans = n; ans > 0 && ret[id] == -1; --ans) { for(int f = max(0, id - ans + 1); f <= id && f + ans <= n; ++f) { if(cache[f][f + ans - 1]) ret[id] = ans; } } } return ret; } int main() { int n; int k; cin >> n >> k; vector A(n); for(int A_i = 0; A_i < n; A_i++){ cin >> A[A_i]; } vector result = costlyIntervals(n, k, A); for (ssize_t i = 0; i < result.size(); i++) { cout << result[i] << (i != result.size() - 1 ? "\n" : ""); } cout << endl; return 0; }