#include <bits/stdc++.h>
using namespace std;
unordered_set<int> curr;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n, x;
  cin >> n >> x;
  srand(100);
  for (int trial = 0; trial <= 2; trial += 1) {
    curr.clear();
    int ans = 0;
    int times = 0;
    while (curr.size() < n - 1) {
      int x = rand() % ((int)1e6 + 1);
      while (curr.count(x)) {
        if (x == 0) break;
        x *= (rand() % (int)1e3);
        continue;
      }
      if (x <= (int)1e6 + 1) {
        curr.insert(x);
        ans ^= x;
      }
    }
    int reqd = ans ^ x;
    if (reqd <= (int)1e6 and curr.count(reqd) == 0) {
      curr.insert(reqd);
    }
    if (curr.size() == n) {
      cout << "YES" << endl;
      for (auto itr : curr) {
        cout << itr << " ";
      }
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
