#include <bits/stdc++.h>
using namespace std;
void my_dbg() { cout << endl; }
template <typename Arg, typename... Args>
void my_dbg(Arg A, Args... B) {
  cout << ' ' << A;
  my_dbg(B...);
}
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9 + 7;
const int maxN = 3e5 + 2;
void solve() {
  int n, x;
  scanf("%d", &n);
  scanf("%d", &x);
  if (n == 1) {
    puts("YES");
    printf("%d\n", (int)(x));
    return;
  }
  if (n == 2) {
    if (x == 0) {
      puts("NO");
      return;
    } else {
      puts("YES");
      printf("%d ", (int)(0));
      printf("%d\n", (int)(x));
      return;
    }
  }
  puts("YES");
  int y = 0;
  for (int i = 1; i < (int)n - 3 + 1; i++) {
    printf("%d ", (int)(i));
    y ^= i;
  }
  int pw = 1 << 17;
  if (x == y) {
    cout << pw << ' ' << pw * 2 << ' ' << (pw ^ (pw * 2)) << '\n';
  } else {
    cout << 0 << ' ' << pw << ' ' << (pw ^ x ^ y) << '\n';
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
