#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x;
  cin >> n >> x;
  if (n == 1) {
    cout << "YES" << '\n';
    cout << x;
  } else if (n == 2 and x == 0)
    cout << "NO";
  else if (n == 2) {
    cout << "YES" << '\n';
    cout << 0 << " " << x << '\n';
  } else {
    long long val1 = pow(2, 17);
    long long val2 = pow(2, 18);
    cout << "YES" << '\n';
    long long xx = 0;
    for (int i = 1; i <= n - 3; i++) {
      cout << i << " ";
      xx ^= i;
    }
    if (xx == x) {
      cout << val1 + val2 << " " << val1 << " " << val2;
    } else {
      long long value = val1 ^ x;
      value ^= xx;
      cout << val1 << " " << value << ' ' << 0;
    }
  }
  return 0;
}
