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