#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  if (x == 0 and n == 2) {
    printf("NO");
    return 0;
  }
  if (n == 1) {
    printf("YES\n%d", x);
    return 0;
  } else if (n == 2) {
    printf("YES\n0 %d", x);
    return 0;
  }
  int r = 0;
  for (int i = 1; i <= n - 3; i++) r = (r ^ i);
  int y = x ^ r;
  int A = y + (1 << 17) + (1 << 18);
  int B = (1 << 17);
  int C = (1 << 18);
  printf("YES\n");
  for (int i = 1; i <= n - 3; i++) printf("%d ", i);
  printf("%d %d %d", A, B, C);
  return 0;
}
