#include <bits/stdc++.h>
using namespace std;
void print(int n, int x) {
  puts("YES");
  if (n % 4 == 3) n -= 3, printf("1 2 3 ");
  int i = 4, a = x - (x % 4), b = x + 3 - (x % 4), c = 0;
  while (c != n) {
    if (i >= a && i <= b) {
      i++;
      continue;
    }
    printf("%d ", i++), c++;
  }
}
int main() {
  int n, x;
  scanf("%d %d", &n, &x);
  int rem = n % 4;
  if (n == 2 && x == 0) {
    puts("NO");
    return 0;
  }
  int m = n;
  m -= (rem == 0 ? 4 : (rem == 1 ? 1 : (rem == 2 && x ? 2 : 3)));
  print(m, x);
  int a = (1 << 18), b = (1 << 19);
  if (rem == 0)
    printf("%d %d %d %d", a, b, (a | b), x);
  else if (rem == 1)
    printf("%d", x);
  else if (rem == 2) {
    if (x)
      printf("0 %d", x);
    else
      printf("%d %d %d", a, b, (a | b | x));
  } else if (rem == 3)
    printf("%d %d %d", a, b, (a | b | x));
  return 0;
}
