#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  if (n == 1) {
    cout << "YES\n" << x;
    return 0;
  }
  if (n == 2) {
    if (x == 0)
      cout << "NO";
    else
      cout << "YES\n" << 0 << ' ' << x;
    return 0;
  }
  int s = 262144 + 131072;
  for (int i = 0; i < n - 3; i++) s = s xor i;
  cout << "YES" << endl << 262144 << ' ' << 131072 << ' ';
  for (int i = 0; i < n - 3; i++) printf("%d ", i);
  cout << (s xor x);
  return 0;
}
