#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 5e5 + 5;
int main() {
  ios ::sync_with_stdio(0), cin.tie(0);
  int n, x;
  cin >> n >> x;
  if (n == 2 && !x) {
    cout << "NO";
    return 0;
  }
  cout << "YES\n";
  int a = n % 4;
  if (a == 1)
    cout << x << ' ';
  else if (a == 2) {
    if (x)
      cout << x << ' ' << 0 << ' ';
    else {
      cout << "1 2 3 " << 7 << ' ' << (1 << 17) + 6 << ' ' << (1 << 17) + 1
           << ' ';
      n -= 4;
    }
  } else if (a == 3) {
    if (!x)
      cout << "1 2 3 ";
    else
      cout << (x | (1 << 19)) << ' ' << 0 << ' ' << (1 << 19) << ' ';
  } else if (!a) {
    if (x == 1)
      cout << "0 2 8 11 ";
    else if (x == 2)
      cout << "1 2 8 9 ";
    else if (x == 3)
      cout << "2 3 9 11 ";
    else
      cout << (1 << 19) + x << " 1 2 " << (1 << 19) + 3 << ' ';
    n -= 4;
  }
  for (int i = 0; i < n - a; ++i) {
    cout << (i | (1 << 18)) << ' ';
  }
  return 0;
}
