Test of Excellence

4

1 votes
Medium
Problem

Rishi is now-a-days boasting a lot about his excellence in Bit-manipulation. As Hasan Habibi is already the most reputed code master of Phantom, he is already irritated with Rishi’s bragging about his skills and decides to end it once and for all. To do so, he decides to challenge Rishi with a task which needs extensive knowledge of bits.

Hasan gives him an array A of n distinct integers. He now asks him to tell in how many ways can he generate a new array B from the elements of A choosing each element from A at most one time such that bitwise-OR of all the elements of array B is equal to k.

Rishi has promised you with a huge treat in Wonder Cafe if you can help him out of this situation. So be quick to help Rishi out.

Input:

The first line consists of number of testcases t.

Each testcase contains two lines. The first line contains two integers n and k. The next line contains n space separated integers denoting the contents of array A.

Output:

Output the number of ways in which array B can be generated. As the answer can be large print for each test case in a new line the number of ways modulo 1000000007.

Constraints:

1<=t<=10

1<=n<=100

1<=k<=255

Explanation for sample test case:

There are 3 ways in which array B can be formed:

[3] , [2,3] and [3,2]

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?