Problem B: Binary Search

Problem B: Binary Search

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 630  Solved: 273
[Submit][Status][Web Board]

Description

The idea of binary search is extremely beautiful! However, write a bug-free binary search program is not so easy. Bo Huang wants you to code a bug-free binary search program for him.

Given an ascending sorted array A with n integers, and if integer m is in the array, returns “YES”, otherwise “NO”

Input

The first line will be an integer T(100<=T<=1000), which is the number of test cases.

For each case have two lines. The first line of the input contains two number n and m, n is the length of the array(1<=n<=106). You should determine whether m (1<=m<=108) is in the array or not. The second line contains the values in the array.

Output

For each case, output only one line print YES or NO.

Sample Input

2
3 2
1 2 3
3 4
1 2 3

Sample Output

YES
NO

HINT

Easy Problem.

[Submit][Status]