#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  scanf("%d%d", &n, &x);
  if (n == 1) {
    printf("YES\n");
    printf("%d\n", x);
  } else if (n == 2) {
    if (x == 0)
      printf("NO\n");
    else {
      printf("YES\n");
      printf("0 %d\n", x);
    }
  } else {
    printf("YES\n");
    int tmp = 0;
    int a = (1 << 17);
    int b = (1 << 18);
    for (int i = 0; i < n - 3; i++) {
      printf("%d ", i);
      tmp ^= i;
    }
    printf("%d %d %d\n", a, b, a ^ b ^ tmp ^ x);
  }
  return 0;
}
