#include #include using ll = long long; using ull = unsigned long long; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++) using namespace std; using namespace atcoder; using mint = modint998244353; const int inf = 1000000007; const ll longinf = 1ll << 60; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; vector a(n); rep(i, n) cin >> a[i]; vector s(n + 1); rep(i, n) s[i + 1] = s[i] ^ a[i]; int m = 1 << 20; vector l(m, -1), r(m, -1); int left = -1, right = n + 1; rep(i, n + 1) { if(r[s[i]] != -1) { left = max(left, r[s[i]]); right = min(right, i); } r[s[i]] = i; if(l[s[i]] == -1) { l[s[i]] = i; } } if(left >= right) { cout << "No" << endl; return 0; } if(left == -1) { cout << "Yes" << endl; return 0; } vector ng1(n + 1, vector(128, 0)); vector ng2(n + 1, vector(20, 0)); rep(i, n + 1) { rep(j, 128) { int li = l[s[i] ^ j], ri = r[s[i] ^ j]; if(li != -1 && li < i) { ng1[li][j]++; ng1[i][j]--; } if(ri != -1 && i < ri) { ng1[i][j]++; ng1[ri][j]--; } } } rep(i, n) rep(j, 128) ng1[i + 1][j] += ng1[i][j]; rep(i, n + 1) { rep(j, 20) { int v = (1 << j) - 1; int li = l[s[i] ^ v], ri = r[s[i] ^ v]; if(li != -1 && li < i) { ng2[li][j]++; ng2[i][j]--; } if(ri != -1 && i < ri) { ng2[i][j]++; ng2[ri][j]--; } } } rep(i, n) rep(j, 20) ng2[i + 1][j] += ng2[i][j]; bool can = false; REP(i, left, right) { for(int j = max(1, a[i] - k); j <= a[i] + k; j++) { int v = j ^ a[i]; if(v < 128) { if(!ng1[i][v]) { can = true; } } else { ++v; int c = 0; while(!(v & 1)) { v /= 2; ++c; } assert(v == 1); if(!ng2[i][c]) { can = true; } } } } cout << (can ? "Yes" : "No") << endl; return 0; }