#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int n, x;
    in >> n >> x;
    if (n == 1) {
      return void(out << "YES\n" << x << '\n');
    } else if (n == 2) {
      if (x == 0) return void(out << "NO\n");
      return void(out << "YES\n" << x << ' ' << 0 << '\n');
    }
    int magic = 1 << 19;
    int xr = magic;
    for (int i = 3; i <= n - 1; ++i) xr ^= i;
    xr ^= x;
    out << "YES\n";
    for (int i = 3; i <= n - 1; ++i) out << i << ' ';
    if (xr == magic) {
      out << magic << ' ' << magic + 1 << ' ' << 1 << '\n';
    } else
      out << magic << ' ' << xr << ' ' << 0;
  }
};
void solve(std::istream& in, std::ostream& out) {
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
