# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Subset AND

By YouKnowWho · 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
```

• Greedy

### Statistics

84% Solution Ratio

SwampFireEarliest, 5M ago 