#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    if (n == 1) {
      printf("YES\n%d\n", m);
    } else if (n == 2) {
      if (m == 0) {
        printf("NO\n");
      } else {
        printf("YES\n0 %d\n", m);
      }
    } else {
      int x = 1 << 18, y = 1 << 19, z = 0;
      printf("YES\n");
      for (int i = 1; i <= n - 3; i++) {
        printf("%d ", i);
        z = z ^ i;
      }
      printf("%d %d %d\n", x, y, (x ^ y ^ z ^ m));
    }
  }
}
