#include <bits/stdc++.h>
using namespace std;
const int N = int(2e5) + 5;
const int inf = (int)1e9 + 7;
const long long linf = (long long)1e18 + 7;
hash<string> st;
mt19937 rng(
    st("asdjklaslkjldsjdlasjdljasldjasldjlasjdl;"
       "asjqiwueioqwuioeuoiqwueiouqwioeqwoeuaksdjkasdjkslkllllllllasdjskdsjkdja"
       "klsjdklqwieiquwioeanzm,xcnm,asndqwjepoqw89834lasljd"));
int n, x;
vector<int> p;
void shandom_ruffle() {
  for (int i = 0; i < (int)p.size(); ++i) {
    int to = rng() % (int)(p.size());
    swap(p[to], p[i]);
  }
}
int main() {
  scanf("%d %d", &n, &x);
  if (n == 1) {
    printf("%YES\n%d\n", x);
    return 0;
  }
  if (n == 2) {
    if (!x) {
      printf("NO\n");
    } else {
      printf("YES\n0 %d\n", x);
    }
    return 0;
  }
  for (int i = 0; i < (int)1e6; ++i) {
    p.push_back(i);
  }
  while (true) {
    shandom_ruffle();
    int tot = 0;
    for (int i = 0; i + 1 < n; ++i) {
      tot ^= p[i];
    }
    tot ^= x;
    int can = 1;
    if (tot > (int)1e6) {
      can = 0;
    }
    for (int i = 0; i + 1 < n; ++i) {
      if (p[i] == tot) {
        can = 0;
      }
    }
    if (can) {
      printf("YES\n");
      for (int i = 0; i + 1 < n; ++i) {
        printf("%d ", p[i]);
      }
      printf("%d\n", tot);
      return 0;
    }
  }
  return 0;
}
