#K73022. Pair Sum Existence

    ID: 33883 Type: Default 1000ms 256MiB

Pair Sum Existence

Pair Sum Existence

You are given an integer n representing the number of elements in an array, an integer k representing a target sum, and an array of n integers. Your task is to determine whether there exists a pair of indices \(1 \leq i < j \leq n\) such that the sum of the two elements equals k. If such a pair exists, output "YES"; otherwise, output "NO".

For example, consider n = 5, k = 9 and the array [1, 5, 3, 4, 6]. The pair (5, 4) sums to 9, so the correct output is "YES".

This problem requires you to implement an efficient solution possibly using a hash set to check for the existence of the complement as you iterate through the array.

inputFormat

The input is given via standard input (stdin) and has the following format:

n k
a1 a2 ... an

Here, n is the number of elements in the array, k is the target sum, and ai are the elements of the array.

outputFormat

Output a single line to standard output (stdout) containing either "YES" if there exists a pair of elements whose sum equals k, or "NO" if no such pair exists.

## sample
5 9
1 5 3 4 6
YES

</p>