#include <bits/stdc++.h>

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<int> ans;
    for (int i = 0; i < m; i++) {
        ans.push_back(1000000 + i);
    }

    vector<int> hoge;
    if (n % 4 == 0) {
        if (x == 1) hoge = {1,2,4,6};
        else hoge = {1,2,3,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 = {1, 4, 5};
        else hoge = {2, 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;
}