#include using namespace std; using ull = unsigned long long; int msb(ull x) { return 63 - __builtin_clzll(x); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; ull B; cin >> N >> B; vector A(N); for (ull& x : A) cin >> x; const int K = msb(B); vector lower; vector same; ull totalXor = 0; for (ull x : A) { int k = msb(x); if (k < K) { lower.push_back(x); totalXor ^= x; } else if (k == K) { same.push_back(x); } } const int base = (int)lower.size(); // edge[j] の第 l ビットが1 // ⇔ j から l へ直接移動できる vector edge(K, 0); for (ull x : lower) { int l = msb(x); for (int j = 0; j < l; ++j) { if (((x >> j) & 1ULL) == 0) { edge[j] |= 1ULL << l; } } } // reach[j]: jから到達可能な最高位ビットの集合 vector reach(K, 0); for (int j = K - 1; j >= 0; --j) { reach[j] = 1ULL << j; for (int l = j + 1; l < K; ++l) { if ((edge[j] >> l) & 1ULL) { reach[j] |= reach[l]; } } } for (ull x : same) { /* * x と lower の全モンスターを倒した後の攻撃力。 * 逆向きには、この値から開始する。 */ ull finalPower = B ^ totalXor ^ x; // 0 からなら、どのモンスターも逆向きに追加できる if (finalPower == 0) { cout << base + 1 << '\n'; return 0; } int start = msb(finalPower); /* * 到達可能な最高位 l のどこかで * x の第 l ビットが0なら、xを逆向きに追加できる。 */ if ((reach[start] & ~x) != 0) { cout << base + 1 << '\n'; return 0; } } cout << base << '\n'; return 0; }