#include <bits/stdc++.h>
using namespace std;
const long base = 97;
long n, m, x;
long a[1000005];
void nhap() { cin >> n >> x; }
void xl() {
  long long res = 0;
  for (long i = 1; i <= n - 3; i++) {
    cout << i << " ";
    res = res ^ i;
  }
  if (res == x) {
    cout << (1 << 17) << " " << (1 << 18) << " " << ((1 << 17) ^ (1 << 18))
         << endl;
  } else {
    cout << (res ^ (x ^ (1 << 17))) << " " << (1 << 17) << " " << 0 << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  nhap();
  if (n == 1) {
    cout << "YES" << endl;
    cout << x;
    return 0;
  }
  if (n == 2 && x == 0) {
    cout << "NO" << endl;
    return 0;
  }
  if (n == 2) {
    cout << "YES\n";
    cout << x << endl << 0;
    return 0;
  }
  cout << "YES" << endl;
  xl();
  return 0;
}
