#include <bits/stdc++.h>
using namespace std;
const int pw = 1 << 17;
const int maxn = 1e5 + 20;
int ans[maxn];
void work() {
  int n, x;
  cin >> n >> x;
  if (n == 1) {
    printf("YES\n");
    cout << x << endl;
    return;
  } else if (n == 2 && x == 0) {
    printf("NO\n");
    return;
  }
  printf("YES\n");
  int t = x;
  for (int i = 0; i < n; ++i) ans[i] = i;
  for (int i = 0; i < n - 1; ++i) {
    t ^= ans[i];
  }
  if (t <= n - 2) {
    ans[t] ^= pw;
    if (t == n - 2)
      ans[t - 1] ^= pw;
    else if (t == 0)
      ans[t + 1] ^= pw;
    else
      ans[t + 1] ^= pw;
  }
  ans[n - 1] = t;
  int res = 0;
  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
    res ^= ans[i];
  }
}
int main() {
  work();
  return 0;
}
