#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 7;
int n, x;
int main() {
  cin >> n >> x;
  int ans = 0, num = 0;
  if (n == 2 && x == 0) {
    puts("NO");
    return 0;
  }
  puts("YES");
  if (n == 1)
    printf("%d", x);
  else if (n == 2)
    printf("%d %d", 0, x);
  else if (n == 3) {
    int t1 = 1 << 18;
    int t2 = 1 << 19;
    int t3 = x ^ t1 ^ t2;
    printf("%d %d %d", t1, t2, t3);
  } else {
    for (int i = 1;; i++) {
      if (i == x) continue;
      ans ^= i;
      printf("%d ", i);
      num++;
      if (num == n - 3) break;
    }
    int t1 = 1 << 18;
    int t2 = 1 << 19;
    int t3 = x ^ ans ^ t1 ^ t2;
    printf("%d %d %d", t1, t2, t3);
    ans ^= t1 ^ t2 ^ t3;
  }
  return 0;
}
