#T788. 寻找两数和
寻找两数和
Description
There is a non-decreasing integer sequence . Given an integer , determine whether there exist two numbers in the sequence whose sum equals . 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, and (where and are both less than 100,000), representing the number of elements in the integer sequence and the target sum , respectively. The second line contains integers, to , 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