#include <bits/stdc++.h>
int main() {
  int n, x;
  std::cin >> n >> x;
  if (x == 0 && n == 2) {
    std::cout << "NO\n";
    return 0;
  }
  if (n == 1) {
    std::cout << "YES\n" << x;
    return 0;
  }
  int num = 1;
  int cnt = 0;
  int res = 0;
  std::vector<int> ans;
  while (cnt < n - 2) {
    if (((res ^ num) ^ x) == 0) {
      ++num;
    } else {
      ans.push_back(num);
      res ^= num;
      ++cnt;
      ++num;
    }
  }
  ans.push_back(x ^ res | (1 << 19));
  ans.push_back(1 << 19);
  std::cout << "YES\n";
  for (int i = 0; i < n; ++i) {
    std::cout << ans[i] << " ";
  }
}
