#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using i64 = int64_t; using i32 = int32_t; template void init_n(vector& v, size_t n, U x) { v = vector(n, x); } template void init_n(vector& v, size_t n) { init_n(v, n, T()); } template void read_n(vector& v, size_t n, size_t o = 0) { v = vector(n+o); for (size_t i=o; i> v[i]; } template void read_n(T a[], size_t n, size_t o = 0) { for (size_t i=o; i> a[i]; } template T gabs(const T& x) { return max(x, -x); } #define abs gabs i64 n, x; int main() { cin >> n >> x; vector res; i64 cnt = 0; for (i64 i = 4; cnt < n - 4; i += 4, cnt += 4) { if (i <= x && x < i + 4) continue; for (i64 j = 0; j < 4; ++j) res.push_back(i + j); } i64 d = n - cnt; if (d == 1) { res.push_back(x); } else if (d == 2) { res.push_back(x ^ 1); res.push_back(1); } else if (d == 3) { res.push_back(x ^ 3); res.push_back(1); res.push_back(2); } else if (d == 4) { res.push_back(x); res.push_back(1); res.push_back(2); res.push_back(3); } for (i64 a : res) cout << a << '\n'; return 0; }