Limits 1s, 512 MB

You are given an array A of n integers and an integer k. You need to find if there is any non-empty subset in the array such that the bitwise AND of all integers in the subset is less than k or not.

Input

The first line contains an integer t(1 ≤ t ≤ 50), the number of test cases.

For each test case, the first line contains two integers n(1 ≤ n ≤ 105) , k(0 ≤ k ≤ 109) and the next line contains n integers Ai(0 ≤ Ai ≤ 109) where Ai is the ith element of the array.

It is guaranteed that the sum of lengths of all given arrays doesn't exceed 5*105.

Output

Output "YES"(without quotes) if there is any subset in the array such that the bitwise AND of all integers in the subset is less than k and output "NO"(without quotes) otherwise.

Sample

InputOutput
2
2 3
1 1
1 2
4
YES
NO

Submit

Login to submit.

Statistics

86% Solution Ratio
SwampFireEarliest, Dec '19
defaltFastest, 0.0s
defaltLightest, 5.5 kB
radoanrichiShortest, 169B
Toph uses cookies. By continuing you agree to our Cookie Policy.