#K66917. Pair Sum Check
Pair Sum Check
Pair Sum Check
In this problem, you are given a list of integers and a target integer . Your task is to determine whether there exists a pair of distinct elements in the list such that their sum equals , i.e., whether there exist indices and with such that $$a_i + a_j = T.$$
Input consists of an integer (the number of integers) and an integer on the first line, followed by integers on the second line. Output "YES" if such a pair exists, otherwise output "NO".
inputFormat
The first line of input contains two space-separated integers: (the number of elements) and (the target sum). The second line contains space-separated integers representing the list.
outputFormat
Output a single line containing “YES” if there exists a pair of integers in the list whose sum is equal to , otherwise output “NO”.## sample
5 9
2 7 11 15 3
YES