#include <bits/stdc++.h>
using namespace std;
const int inf = 1e6;
int main() {
  int n, k, n1;
  unsigned int ans = 0;
  cin >> n >> k;
  vector<long long> res;
  n1 = n;
  if (k == 0 && n == 2) {
    cout << "NO";
    return 0;
  }
  if (n == 2) {
    cout << "YES" << endl << "0 " << k;
    return 0;
  }
  if (n == 1) {
    cout << "YES" << endl << k;
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n - 3; i++) {
    cout << i << " ";
    k ^= i;
  }
  int p18 = 1 << 18;
  int p17 = 1 << 17;
  cout << (p18 ^ p17 ^ k) << ' ' << p18 << ' ' << p17 << endl;
  return 0;
}
