#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e9 + 7;
bool solve() {
  long long int n, x, y(0);
  cin >> n >> x;
  if (n == 2 && x == 0) {
    printf("NO");
    return 1;
  }
  printf("YES\n");
  for (long long int i(1); i <= n - 3; i++) {
    y ^= i;
    printf("%lld ", i);
  }
  long long int pw = 1 << 17;
  if (n == 1) {
    printf("%lld", x);
    return 1;
  }
  if (n == 2) {
    printf("0 %lld", x);
    return 1;
  }
  if (y == x) {
    printf("%lld %lld %lld", pw, pw * 2, pw ^ (pw * 2));
  } else {
    printf("0 %lld %lld", pw, (pw ^ x ^ y));
  }
  return 1;
}
int main() {
  solve();
  return 0;
}
