Doya and XOR#11855

Doya and XOR

3 seconds
256 megabytes
Medium

Doya gave Miku an array of size and an integer and told her that for every (1 \le y \le x) she has to count the number of pairs such that:

Can you help her solve this problem?

Input

Each test contains multiple test cases.

The first line contains a single integer (1 \le t \le 1000) — the number of test cases.

The first line of each test case contains two integers , (1 \le n \le 5 \cdot 10^4, 1 \le x \le 30).

The second line of each test case contains integers a_1, a_2, \dots, a_n (0 \le a_i \le 2^{30}).

It is guaranteed that the sum of over all test cases does not exceed 5 \cdot 10^4.

Output

For each test case, print one line consisting of integers separated by a space (For every (1 \le y \le x) you need to output the number of pairs ).

Examples

Example

Input

2
3 3
1 2 3
5 13
104 23 12 1 0
Output
%
4 3 3
9 8 6 5 5 5 5 5 5 5 5 5 5

Example 1

Loading
Loading

Note

For the first test case a = [1, 2, 3] and x = 3, let's consider all values among the array :

  • a_1 \oplus a_1 = 0

  • a_2 \oplus a_2 = 0

  • a_3 \oplus a_3 = 0

  • a_1 \oplus a_2 = 3

  • a_1 \oplus a_3 = 2

  • a_2 \oplus a_3 = 1

Consider values of :

  • For y = 1 : There are values with and a single value with , thus there're pairs : (1, 1), (2, 2), (3, 3), (1, 3)

  • For y = 2 : There are values with so we only consider them.

  • For y = 3 : There are values with so we only consider them.

For the second test case a = [104, 23, 12, 1, 0] and x = 13, let's consider all values among the array :

  • a_1 \oplus a_1 = 0

  • a_2 \oplus a_2 = 0

  • a_3 \oplus a_3 = 0

  • a_4 \oplus a_4 = 0

  • a_5 \oplus a_5 = 0

  • a_1 \oplus a_2 = 127

  • a_1 \oplus a_3 = 100

  • a_1 \oplus a_4 = 105

  • a_1 \oplus a_5 = 104

  • a_2 \oplus a_3 = 27

  • a_2 \oplus a_4 = 22

  • a_2 \oplus a_5 = 23

  • a_3 \oplus a_4 = 13

  • a_3 \oplus a_5 = 12

  • a_4 \oplus a_5 = 1

Consider values of :

  • For y = 1 : There are values with and even numbers, thus there're pairs.

  • For y = 2 : There are values with and multiples of , thus there're pairs.

  • For y = 3 : There are values with and multiple of , which is , so there're pairs.

  • For y \ge 4 : We only consider 's so the answer is .

Scoring

  1. Subtask ( points): a_1 = a_2 = a_3 = \dots = a_n

  2. Subtask ( points): \sum n \le 1000

  3. Subtask ( points): x = 1

  4. Subtask ( points): a_i is a power of

  5. Subtask ( points): a_i \le 10^6

  6. Subtask ( points): No additional constraints.