#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n, x, g = 1;
  for (int i = 0; i < 18; i++) g *= 2;
  cin >> n >> x;
  if (n == 1) {
    cout << "YES" << '\n';
    cout << x << '\n';
    return 0;
  }
  if (n == 2) {
    if (x == 0) {
      cout << "NO" << '\n';
      return 0;
    }
    cout << "YES" << '\n';
    cout << 0 << " " << x << '\n';
    return 0;
  }
  int t = 0, f = 0;
  for (int i = 2; i < n; i++) t ^= i;
  if (t == x) {
    t = 0;
    for (int i = 1; i < n - 1; i++) t ^= i;
    f = 1;
  }
  cout << "YES" << '\n';
  cout << g << " ";
  cout << (g ^ t ^ x) << " ";
  for (int i = 2 - f; i < n - f; i++) cout << i << " ";
  return 0;
}
