A. All Closed
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

Sulfox the fennec fox gives you $$$n$$$ sets $$$S_1,S_2,\ldots,S_n$$$, each containing distinct integers between $$$0$$$ and $$$2^m-1$$$.

You may perform the following operation any number (possibly zero) of times: choose an integer $$$x$$$ with $$$0\le x \lt 2^m$$$, and for every $$$i=1,2,\ldots,n$$$, insert $$$x$$$ into $$$S_i$$$ if it is not already present.

A set $$$S$$$ is called XOR-closed if, for every $$$x,y\in S$$$, we have $$$x\oplus y\in S$$$, where $$$\oplus$$$ denotes the bitwise exclusive-OR operation.

Find the minimum number of operations required to make all $$$S_i$$$ XOR-closed, and construct any sequence of operations achieving this minimum.

Input

The first line contains two integers $$$n$$$ ($$$1\le n\le 2 \times 10^5$$$) and $$$m$$$ ($$$1\le m\le 20$$$).

The $$$i$$$-th of the next $$$n$$$ lines contains an integer $$$c_i$$$ ($$$c_i \ge 1$$$), followed by $$$c_i$$$ distinct integers $$$a_{i,1},a_{i,2},\ldots,a_{i,c_i}$$$ ($$$0\le a_{i,j} \lt 2^m$$$), representing the elements of $$$S_i$$$.

It is guaranteed that the sum of $$$c_i$$$ does not exceed $$$10^6$$$.

Output

On the first line, print the minimum number of operations $$$k$$$.

On the second line, print $$$k$$$ integers $$$x_1,x_2,\ldots,x_k$$$, where $$$x_i$$$ denotes the integer chosen in the $$$i$$$-th operation.

If there are multiple optimal solutions, output any of them.

Examples
Input
3 3
1 1
3 0 1 7
6 1 2 3 4 5 7
Output
3
0 7 6
Input
1 4
4 11 5 14 0
Output
0

Note

For the first example, after performing the shown operations, $$$S_1$$$ and $$$S_2$$$ become $$$\{0,1,6,7\}$$$, while $$$S_3$$$ becomes $$$\{0,1,2,3,4,5,6,7\}$$$. It can be proved that it is impossible to make all sets XOR-closed using less than $$$3$$$ operations.

For the second example, the only set is already XOR-closed, so no operation is needed.