#include <bits/stdc++.h>
const int maxn = 1e5 + 10;
int n, x;
int ans[maxn];
int main() {
  scanf("%d%d", &n, &x);
  if (x == 0 && n == 2) {
    puts("NO");
    return 0;
  }
  if (n == 1) {
    printf("YES\n%d\n", x);
    return 0;
  }
  if (n == 2) {
    printf("YES\n%d %d\n", 0, x);
    return 0;
  }
  int cur = 0;
  for (int i = 1; i <= n - 3; ++i) {
    ans[i] = i;
    cur ^= i;
  }
  int tmp = cur ^ x;
  ans[n - 2] = (1 << 19) | tmp;
  ans[n - 1] = (1 << 18);
  ans[n] = (1 << 19) | (1 << 18);
  puts("YES");
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  puts("");
}
