#include #include #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace std; using namespace atcoder; typedef long long ll; int f(vector a) { int n = a.size(); unordered_map ma; int x = 0; ma[0]++; rep(i, 0, n) { x ^= a[i]; ma[x]++; } x = 0; int ct = 0; rep(i, 0, n) { ma[x]--; ct += ma[x]; x ^= a[i]; } return ct; } int main() { int n, k; cin >> n >> k; vector a(n); rep(i, 0, n) cin >> a[i]; unordered_map ma; int x = 0; ma[0]++; rep(i, 0, n) { x ^= a[i]; ma[x]++; } x = 0; int l = 0; int ct = 0; rep(i, 0, n) { ma[x]--; ct += ma[x]; if (ma[x]) l = i; x ^= a[i]; } if (ct >= 2) { cout << "No" << endl; return 0; } if (ct == 0) { cout << "Yes" << endl; return 0; } int r = l; x = a[l]; while (x != 0) { r++; x ^= a[r]; } rep(i, -k, +k + 1) { a[l] += i; int ct = f(a); if (ct == 0) { cout << "Yes" << endl; return 0; } a[l] -= i; a[r] += i; ct = f(a); if (ct == 0) { cout << "Yes" << endl; return 0; } a[r] -= i; } cout << "No" << endl; }