#include using namespace std; using namespace chrono; int main() { auto start = system_clock::now(); random_device rnd; mt19937 mt(rnd()); int n, m; cin >> n >> m; int a[n]; uniform_int_distribution<> rand(0, n - 1); for (auto &i : a) { cin >> i; } if (m < n) { int d = n - m, x = 0; for (int i = 0; i < m; i++) { x ^= a[i]; } while (duration_cast(system_clock::now() - start).count() < 1450) { for (int t = 0; t < 1 << 15; t++) { int i = rand(mt) % m, j = rand(mt) % d + m; int y = x ^ a[i] ^ a[j]; if (x < y) { x = y; swap(a[i], a[j]); } } } } for (int i = 0; i < m; i++) { cout << a[i] << ' '; } cout << endl; return 0; }