mt19937_64 randdev(8901016); inline int rand(int l, int h) { return uniform_int_distribution(l, h)(randdev); } int N,M,A[100010]; int x,best; vector used,unused,ans; { rd(N,M,A(N)); REP(i,M) x ^= A[N-i-1], used.push_back(N-i-1); REP(i,N-M) unused.push_back(i); REP(_,2000100){ int j = rand(0,M-1); int k = rand(0,N-M-1); x ^= A[used[j]]; x ^= A[unused[k]]; if (x > best){ best = x; if (_ > N/10){ ans = used; } } } REP(i,M) wtSp(A[ans[i]]); }