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