#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  if (n % 2) {
    int xr = 0;
    cout << "YES" << endl;
    for (int i = 0, j = 1000000; i < n - 1; i++, j--) {
      cout << j << ' ';
      xr ^= j;
    }
    cout << (xr ^ x);
    return 0;
  }
  int xr = 0;
  for (int i = 0, j = 1000000; i < n - 2; i++, j--) {
    xr ^= j;
  }
  if (xr != x) {
    cout << "YES" << endl;
    for (int i = 0, j = 1000000; i < n - 2; i++, j--) {
      cout << j << ' ';
    }
    cout << 0 << ' ' << (xr ^ x);
    return 0;
  }
  cout << "NO" << endl;
}
