| TheForces Round #25(5^2-Forces) |
|---|
| Finished |
You are given an array $$$a$$$ of $$$n$$$ non-negative integers and an integer $$$k$$$.
In one operation you can do:
Here $$$\&$$$ denotes the bitwise AND operation.
Find the minimum number of operations to make all elements to zero.
If it's impossible to make all elements to zero, output $$$-1$$$ instead.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10000$$$). The description of the test cases follows.
The first line of each testcase contains two integers $$$n,k$$$ ($$$1 \le n,k \le 10000$$$).
The second line of each testcase contains $$$n$$$ integers $$$a_1,a_2,\ldots, a_n$$$ ($$$0 \le s_i \le 10000$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10000$$$.
For each test case, print a single integer — the minimum number of operations to make all elements to zero. If it's impossible to make all elements to zero, output $$$-1$$$ instead.
41 104 41 3 2 84 31 3 2 88 11 5 17 29 1000 11 45 22
0 1 2 -1
| Name |
|---|


