#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
const int N = 1000005;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x;
  cin >> n >> x;
  if (n == 1) {
    cout << "YES\n";
    cout << x;
    return 0;
  }
  if (n == 2) {
    if (x == 0)
      cout << "NO";
    else {
      cout << "YES\n";
      cout << "0 " << x;
    }
    return 0;
  }
  vector<int> v;
  v.push_back(100000);
  v.push_back(200000);
  for (int i = 0; i < n - 3; i++) v.push_back(i);
  int ans = 0;
  for (int i = 0; i < v.size(); i++) ans ^= v[i];
  v.push_back(ans ^ x);
  cout << "YES\n";
  ans = 0;
  for (int i = 0; i < n; i++) ans ^= v[i], cout << v[i] << " ";
  return 0;
}
