use std::io::{stdin, Read}; fn main() { let mut buf = String::new(); stdin().read_to_string(&mut buf).unwrap(); let mut buf = buf.split_whitespace(); let mut get = || buf.next().unwrap().parse::().unwrap(); let n = get() as usize; let m = get() as usize; let mut xs = vec![]; for _ in 0..n { xs.push(get()); } let mut v = 0; for i in 0..m { v ^= xs[i]; } if m < n { for i in 0..500 { for j in 0..n { let mut i = (j % 19 + j * 3 + i * i + (j + i) % 7 + m + i % 103 + i % 31) % n; if i < m { if n == m { i = m; } else { i = m + i % (n - m); } } let e = v ^ xs[j] ^ xs[i]; if e > v { xs.swap(i, j); v = e; } } } } for i in 0..m { if i > 0 { print!(" "); } print!("{}", xs[i]); } println!(); }