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