codeforces#P1477A. Nezzar and Board
Nezzar and Board
Description
distinct integers are written on the board. Nezzar can perform the following operation multiple times.
- Select two integers (not necessarily distinct) on the board, and write down . Note that you don't remove selected numbers.
Now, Nezzar wonders if it is possible to have his favorite number on the board after applying above operation multiple times.
The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers (, ).
The second line of each test case contains distinct integers ().
It is guaranteed that the sum of for all test cases does not exceed .
For each test case, print "YES" on a single line if it is possible to have on the board. Otherwise, print "NO".
You can print each letter in any case (upper or lower).
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers (, ).
The second line of each test case contains distinct integers ().
It is guaranteed that the sum of for all test cases does not exceed .
Output
For each test case, print "YES" on a single line if it is possible to have on the board. Otherwise, print "NO".
You can print each letter in any case (upper or lower).
Samples
Note
In the first test case, the number is already on the board.
In the second test case, Nezzar could perform the following operations to write down on the board:
- Select and and write down on the board.
- Select and and write down on the board.
- Select and and write down on the board.
In the third test case, it is impossible to have the number on the board.