#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  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");
    int xr = 0;
    for (int i = 1; i <= n - 3; i++) {
      printf("%d ", i);
      xr ^= i;
    }
    int a, b, c;
    if (xr == x) {
      a = 1 << 17;
      b = 1 << 18;
      c = a ^ b;
    } else {
      a = 1 << 17;
      b = a | (x ^ xr);
      c = 0;
    }
    printf("%d %d %d\n", a, b, c);
  }
}
