#include #include #include #include #include #include #include #include #include #include #include #include #include #pragma warning(disable:4996) typedef long long ll; #define MIN(a, b) ((a)>(b)? (b): (a)) #define MAX(a, b) ((a)<(b)? (b): (a)) #define LINF 9223300000000000000 #define INF 2140000000 const long long MOD = 1000000007; using namespace std; int main(int argc, char* argv[]) { int n,x; scanf("%d%d", &n, &x); int k=(n-1)%4; if(k==0) { //nothing } else if(k==1) { printf("1\n"); x = (x^1); } else if(k==2) { printf("1\n"); printf("2\n"); x = ((x^1)^2); } else if(k==3) { printf("1\n"); printf("2\n"); printf("3\n"); } printf("%d\n", x); int n2=n-k-1; if(n2>0) { assert(n2%4==0); int i; int cnt=0; for(i=1; i<=n2+1; n2++) { int t; for(t=0; t<4; t++) { if(i*4+t==x) break; } if(t==4) { for(t=0; t<4; t++) { printf("%d\n", i*4+t); } cnt++; } if(cnt==n2) break; } } return 0; }