#include using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, x; cin >> n >> x; int m = (n-1) / 4 * 4; vector ans; for (int i = 0; i < m; i++) { ans.push_back(1000000 + i); } int foo = (1 << 22); vector hoge; if (n % 4 == 0) { if (x == 1) hoge = {1,2,4,6}; else hoge = {foo + 1, foo + 2, foo + 3, foo + x}; } else if (n % 4 == 1) { hoge = {x}; } else if (n % 4 == 2) { if (x == 1) hoge = {2, 3}; else hoge = {1, (x^1)}; } else { if (x == 1) hoge = {2, 4, 7}; else hoge = {foo + 2, foo + 3, (x^1)}; } for (int x : hoge) ans.push_back(x); assert(ans.size() == n); for (int i = 0; i < n; i++) { cout << ans[i] << "\n"; } return 0; }