#include <bits/stdc++.h>
using namespace std;
int pw = pow(2, 17) + 10;
int main() {
  int n, x;
  scanf("%d %d", &n, &x);
  if (n == 1) {
    cout << "YES\n";
    cout << x << endl;
    return 0;
  }
  if (n == 2 && x == 0) {
    cout << "NO\n";
    return 0;
  } else if (n == 2) {
    cout << "YES\n";
    cout << 0 << " " << x << endl;
    return 0;
  } else {
    cout << "YES\n";
  }
  int y = 0;
  for (int i = 1; i <= n - 3; i++) {
    y = y xor i;
    cout << i << " ";
  }
  if (y == x) {
    cout << (pw * 2) << " " << pw << " " << ((pw * 2) xor pw) << endl;
  } else {
    cout << 0 << " " << pw << " " << (pw xor x xor y) << endl;
  }
  return 0;
}
