#include <bits/stdc++.h>
using namespace std;
int n, x;
int sum = 0;
int main() {
  scanf("%d%d", &n, &x);
  if (n == 2 && x == 0)
    printf("NO\n");
  else if (n == 1) {
    printf("YES\n%d\n", x);
  } else {
    printf("YES\n");
    for (int i = 1; i <= n - 2; i++) {
      sum ^= i;
    }
    int mx = 300000;
    if (sum == 0 || sum == x) {
      sum = 0;
      for (int i = 0; i < n - 2; i++) {
        sum ^= i;
      }
      if (sum == 0 || sum == x) {
        sum = 0;
        for (int i = 2; i <= n - 1; i++) {
          sum ^= i;
          printf("%d ", i);
        }
      } else {
        for (int i = 0; i < n - 2; i++) printf("%d ", i);
      }
    } else {
      for (int i = 1; i <= n - 2; i++) printf("%d ", i);
    }
    printf("%d ", mx);
    sum ^= mx;
    sum ^= x;
    printf("%d\n", sum);
  }
  return 0;
}
