#include <bits/stdc++.h>
using namespace std;
int a[500000] = {0};
int main() {
  int n, x;
  cin >> n >> x;
  int pos = 0, temp = x;
  if (n == 2 && x == 0)
    printf("NO");
  else {
    printf("YES\n");
    if (n == 1) {
      printf("%d", x);
      return 0;
    }
    for (int i = 0; i < n - 1; i++) a[i] = i;
    a[0] = a[0] + 1 << 17;
    a[1] = a[1] + 1 << 18;
    int t = 0;
    for (int i = 0; i < n - 1; i++) {
      t ^= a[i];
    }
    a[n - 1] = t ^ x;
    for (int i = 0; i < n; i++) {
      if (i != 0) printf(" ");
      printf("%d", a[i]);
    }
  }
}
