#5622. K Subset Xors
0
K Subset Xors
K Subset Xors
You are given an array of n integers. Consider the xors of all 2^n subsets of the array (including the empty subset with xor equal to zero). Your task is to find the k smallest subset xors.
Input
The first line has two integers n and k: the size of the array and the number of subset xors k. The next line has n integers x_1, x_2,\dots, x_n: the contents of the array.
Output
Print k integers: the k smallest subset xors in increasing order.
Constraints
\cdot 10^5$
Example
Input
4 9
3 5 14 8
Output
0 0 3 3 5 5 6 6 8