#include <bits/stdc++.h>
using namespace std;
int main() {
  int pw = pow(2, 17);
  int n, k;
  cin >> n >> k;
  if (n == 2 && k == 0) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  if (n == 1)
    cout << k;
  else if (n == 2) {
    cout << "0 " << k;
  } else {
    int xr = 0;
    for (int i = 1; i <= n - 3; i++) {
      cout << i << " ";
      xr = xr ^ i;
    }
    if (xr == k) {
      cout << pw << " " << (pw * 2) << " " << (pw ^ (pw * 2));
    } else {
      cout << "0 " << pw << " " << (pw ^ k ^ xr);
    }
  }
  return 0;
}
