#include #include #include #include using namespace std; int n, x; int main() { scanf("%d%d", &n, &x); if (n == 1) printf("%d\n", x); else if (n == 2) { if (x == 1) printf("%d\n%d\n", 2, 3); else printf("%d\n%d\n", 1, x ^ 1); } else if (n == 3) { if (x == 3) printf("%d\n%d\n%d\n", 1, 4, 1 ^ 3 ^ 4); else printf("%d\n%d\n%d\n", 1, 2, x ^ 1 ^ 2); } else { mt19937 rnd(time(0)); unordered_set s; while (true) { s.clear(); int r = 0; while (s.size() < n - 2) { int v = rnd() % 100000 + 1; if (v != x && !s.count(v)) { r ^= v; s.insert(v); } } if (r != x && r <= 100005 && !s.count(r)) { s.insert(r); s.insert(x); break; } } for (auto e : s) { printf("%d\n", e); } } return 0; }