#K76497. Two Sum Query

    ID: 34655 Type: Default 1000ms 256MiB

Two Sum Query

Two Sum Query

Given a list of integers and a target integer (T), determine whether there exist two distinct elements in the list whose sum equals (T). You are required to read from standard input (stdin) and write the result to standard output (stdout). Output the string "YES" if such a pair exists, otherwise output "NO".

Note: Two elements are considered distinct if they come from different positions in the list. The input format is designed to be read from stdin.

inputFormat

The input consists of two lines:

  • The first line contains two integers (N) and (T), where (N) is the number of elements in the list and (T) is the target sum.
  • The second line contains (N) space-separated integers representing the list elements.

outputFormat

Output a single line containing either "YES" if there exists at least one pair of distinct numbers whose sum is equal to (T), or "NO" if no such pair exists.## sample

5 10
2 7 11 15 -5
YES