#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e5 + 10;
int n, x, a[Maxn];
int main() {
  for (; scanf("%d%d", &n, &x) != EOF;) {
    if (n == 1) {
      printf("YES\n");
      printf("%d\n", x);
      continue;
    }
    int y = x;
    for (int i = 1; i < n; i++) y ^= i;
    if (y > n - 1 || y == 0) {
      printf("YES\n");
      for (int i = 1; i < n; i++) printf("%d ", i);
      printf("%d\n", y);
    } else {
      int z = -1;
      for (int i = 1; i < n; i++)
        if (i != y) {
          z = i;
          break;
        }
      if (z == -1) {
        printf("NO\n");
        continue;
      }
      printf("YES\n");
      printf("%d %d %d ", 131072 | z, 131072, 0);
      for (int i = 1; i < n; i++)
        if (i != y && i != z) printf("%d ", i);
      printf("\n");
    }
  }
  return 0;
}
