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