#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
long long n, x;
void printbin(long long a) {
  for (int i = 20; i >= 0; i--) {
    long long c = a & (1LL << i);
    cout << bool(c);
  }
  cout << "\n";
}
int main() {
  cin >> n >> x;
  long long reversed = 0;
  reversed |= 1LL << 17;
  if (n == 1) {
    cout << "YES\n" << x;
    return 0;
  }
  if (n == 2 && x == 0) {
    cout << "NO\n";
    return 0;
  }
  if (n == 2) {
    cout << "YES\n" << 0 << " " << x << "\n";
    return 0;
  }
  cout << "YES\n";
  long long value = 0;
  long long test = 0;
  for (int i = 1; i <= n - 3; i++) {
    cout << i << " ";
    value ^= i;
    test ^= i;
  }
  reversed = x ^ value;
  reversed |= 1LL << 17;
  long long temp2 = 1LL << 17;
  if (reversed == 1LL << 17) {
    reversed |= 1LL << 18;
    long long temp = 1LL << 18;
    cout << reversed << " " << temp << " " << (temp ^ reversed) << "\n";
  } else {
    cout << reversed << " " << temp2 << " " << 0 << "\n";
  }
  return 0;
}
