#K63362. Pair Sum Existence

    ID: 31737 Type: Default 1000ms 256MiB

Pair Sum Existence

Pair Sum Existence

Given an integer n and a target sum x, along with an array a containing n integers, determine if there exists a pair of distinct elements in the array such that their sum equals x. In other words, check if there exist indices i and j (with i < j) that satisfy the equation \(a_i + a_j = x\).

If such a pair exists, output "YES"; otherwise, output "NO".

inputFormat

The input is read from standard input (stdin) and consists of:

  • The first line contains two integers n and x, where n is the number of elements in the array and x is the target sum.
  • The second line contains n space-separated integers, representing the array a.

outputFormat

Output to standard output (stdout) a single line containing either "YES" if there exists a pair of distinct elements whose sum is x, or "NO" otherwise.

## sample
5 9
2 7 11 15 5
YES