#include using namespace std; uint64_t rng() { static uint64_t x = 1; x ^= x << 9; return x ^= x >> 7; } int main() { clock_t start = clock(); int n, m; cin >> n >> m; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int score = 0, best = 0; for (int i = 0; i < m; i++) { score ^= a[i]; } vector ans(m); copy(a.begin(), a.begin() + m, ans.begin()); best = score; while (clock() - start < 1.4 * CLOCKS_PER_SEC) { if (m == 0 or m == n) break; int x = rng() % m, y = rng() % (n - m) + m; score ^= a[x] ^ a[y]; swap(a[x], a[y]); if (score > best) { copy(a.begin(), a.begin() + m, ans.begin()); best = score; } } for (int i = 0; i < m; i++) { cout << ans[i]; if (i < m - 1) cout << ' '; } cout << endl; }