#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  vector<int> ans;
  int tmp;
  if (n == 2 && x == 0) {
    cout << "NO\n";
    return 0;
  }
  int y = 0;
  int i;
  cout << "YES\n";
  if (n == 1) {
    cout << x << '\n';
    return 0;
  } else if (n == 2) {
    cout << 1 << " " << (1 ^ x) << '\n';
    return 0;
  }
  for (i = 1; i <= n - 3; i++) {
    cout << i << " ";
    y ^= i;
  }
  i = 2 * (int)(1e5);
  if (y == x) {
    cout << i << " " << 2 * i << " " << (i ^ (2 * i)) << '\n';
  } else {
    cout << 0 << " " << i << " " << (i ^ x ^ y) << '\n';
  }
  return 0;
}
