#include <bits/stdc++.h>
using namespace std;
int n, x;
int main() {
  cin >> n >> x;
  if (x == 0 && n == 2)
    puts("NO");
  else if (n == 1)
    printf("YES\n%d\n", x);
  else if (n == 2)
    printf("YES\n%d\n%d\n", 0, x);
  else {
    puts("YES");
    for (int i = 0; i < n - 3; ++i) {
      x ^= i;
      cout << i << endl;
    }
    printf("%d\n%d\n%d\n", x ^ (1 << 17) ^ (1 << 18), 1 << 17, 1 << 18);
  }
  return 0;
}
