#include #define DEBUG using ll = long long; ll constexpr INF = 1e18; std::vector solve(ll *a, int n, int minCost) { std::vector res(n, -1); for (int i = 0; i < n; ++i) { for (int j = i; j < n; ++j) { ll OR = a[j], AND = a[j]; ll max = -INF, min = INF; for (int k = i; k <= j; ++k) { max = std::max(max, a[k]); min = std::min(min, a[k]); OR |= a[k]; AND &= a[k]; } ll cost = (OR - AND) - (max - min); if (cost >= minCost) { for (int k = i; k <= j; ++k) { res[k] = std::max(res[k], ll(j - i + 1)); } } } } return res; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int n, k; std::cin >> n >> k; ll a[n]; for (int i = 0; i < n; ++i) { std::cin >> a[i]; } std::vector res = solve(a, n, k); for (int i = 0; i < res.size(); ++i) { std::cout << res[i] << '\n'; } }