#include <bits/stdc++.h>
using namespace std;
int a[1000006];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, x;
  cin >> n >> x;
  if (n == 1) {
    cout << "YES\n";
    cout << x << endl;
    return 0;
  }
  for (int i = 0; i < n - 2; i++) {
    x ^= i;
  }
  for (int i = n - 2; i <= 1000000; i++) {
    if ((x ^ i) >= n - 2 && (x ^ i) != i) {
      cout << "YES\n";
      for (int j = 0; j < n - 2; j++) {
        cout << j << " ";
      }
      x ^= i;
      cout << i << " " << x << endl;
      return 0;
    }
  }
  x ^= (n - 2);
  for (int i = n - 1; i <= 1000000; i++) {
    if ((x ^ i) >= n - 1 && (x ^ i) != i) {
      cout << "YES\n";
      for (int j = 1; j <= n - 2; j++) {
        cout << j << " ";
      }
      x ^= i;
      cout << i << " " << x << endl;
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
