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