eolymp
bolt
Try our new interface for solving problems
Problems

Sum of two

Sum of two

Given an array $A$, sorted in ascending order and containing $n$ integers. Determine whether there exists a pair of numbers $(A_i, A_j)$, where $i < j$, such that their sum is equal to $x$. \InputFile The first line contains two integers $n\:(n \le 10^5)$ and $x\:(x \le 10^6)$. The second line contains $n$ non-negative integers, each of which is not greater than $10^6$. \OutputFile Print \textbf{"YES"} if such a pair of elements exists, and \textbf{"NO"} otherwise.
Time limit 1 second
Memory limit 128 MiB
Input example #1
10 13
1 3 5 6 8 10 11 11 11 16
Output example #1
YES
Input example #2
8 61
5 5 8 12 16 21 44 50
  
Output example #2
NO
Author Michael Medvediev