#include <bits/stdc++.h>
const double eps = 1e-7;
using namespace std;
int n, X;
int main() {
  while (~scanf("%d%d", &n, &X)) {
    if (n == 1) {
      printf("YES\n%d\n", X);
    } else if (n == 2) {
      if (X == 0)
        printf("NO\n");
      else
        printf("YES\n0 %d\n", X);
    } else {
      printf("YES\n");
      vector<int> ans;
      ans.push_back(1 << 17);
      ans.push_back(1 << 18);
      for (int i = 1; i <= n - 3; i++) ans.push_back(i);
      int last = X;
      for (int i = 0; i < n - 1; i++) {
        printf("%d ", ans[i]);
        last ^= ans[i];
      }
      printf("%d\n", last);
    }
  }
  return 0;
}
