#T788. 寻找两数和

寻找两数和

Description

There is a non-decreasing integer sequence a1,a2,,an1,ana_1, a_2, \dots, a_{n-1}, a_n. Given an integer xx, determine whether there exist two numbers in the sequence whose sum equals xx. If such a pair exists, output <span>YES</span>; otherwise, output <span>NO</span>.

Input Format

The input consists of multiple test cases. For each test case, the first line contains two integers, nn and xx (where nn and xx are both less than 100,000), representing the number of elements in the integer sequence and the target sum xx, respectively. The second line contains nn integers, a1a_1 to ana_n, separated by spaces. The sequence satisfies $1 \leq a_1 \leq a_2 \leq \dots \leq a_{n-1} \leq a_n < 2^{31}$. The input ends with a line containing 0.

Output Format

For each test case, output a single line containing either `YES` or `NO`.

```input1 5 10 1 2 3 4 5 6 12 1 3 5 7 9 11 0 0
```output1
NO
YES

Source

CodesOnline