using System; using System.Collections.Generic; using System.Linq; using static System.Console; class Program { static void Main() { var NM = ReadLine().Split().Select(int.Parse).ToArray(); var N = NM[0]; var M = NM[1]; var A = ReadLine().Split().Select(int.Parse).ToArray(); var u = new int[N]; var r = new XorShift(); var res = A.Take(M).Aggregate((x, y) => x ^ y); for (int i = 0; i < M; i++) { u[i] = i; } while (res != 0xFFFFF) { var a = r.Next(M); var b = r.Next(N); res^=A[u[a]]; res^=A[b]; u[a]=b; } for (int i = 0; i < M; i++) { Write($"{A[u[i]]} "); } WriteLine(); } } public class XorShift { uint x = 123456789; uint y = 362436069; uint z = 521288629; uint w = 88675123; public XorShift() { var t = (uint)Environment.TickCount; x ^= t; y ^= Rotate(t, 17); z ^= Rotate(t, 31); w ^= Rotate(t, 18); } uint Rotate(uint u, int n) => (u << n) + (u >> 32 - n); public int Next()// [0, int.MaxValue) { var t = x ^ x << 11; x = y; y = z; z = w; t = w = w ^ w >> 19 ^ t ^ t >> 8; if (t > int.MaxValue) t = ~t; return (int)(t == int.MaxValue ? --t : t); } public int Next(int maxValue) => (int)(NextDouble() * maxValue);// [0, maxValue) public double NextDouble() => (double)Next() / int.MaxValue;// [0.0, 1.0) }