#include using namespace std; #ifdef _RUTHEN #include "debug.hpp" #else #define show(...) true #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) template using V = vector; int main() { ios::sync_with_stdio(false); cin.tie(0); int N, X; cin >> N >> X; V A(N); for (auto &a : A) cin >> a; sort(A.begin(), A.end()); A.erase(unique(A.begin(), A.end()), A.end()); if (A.size() != N) { cout << "No" << '\n'; return 0; } auto rec = [&X](auto f, V &A, int b) -> bool { show(A, b); if (b < 0) return true; if (X >> b & 1) { V L, R; for (auto a : A) { if (a >> b & 1) { R.push_back(a); } else { L.push_back(a); } } if (abs((int)L.size() - (int)R.size()) > 1) { return false; } bool res = true; if (L.size() > 0) res &= f(f, L, b - 1); if (R.size() > 0) res &= f(f, R, b - 1); return res; } else { V L, R; for (auto a : A) { if (a >> b & 1) { R.push_back(a); } else { L.push_back(a); } } bool res = true; if (L.size() > 0) res &= f(f, L, b - 1); if (R.size() > 0) res &= f(f, R, b - 1); return res; } }; cout << (rec(rec, A, 30) ? "Yes" : "No") << '\n'; return 0; }