#C895. Two Elements Sum Problem

    ID: 52988 Type: Default 1000ms 256MiB

Two Elements Sum Problem

Two Elements Sum Problem

Given an array of N integers and an integer K, determine whether there exist two distinct elements in the array whose sum is exactly K. Formally, find if there exist indices i and j with i ≠ j such that

\(a_i + a_j = K\)

Output YES if such a pair exists, or NO otherwise.

inputFormat

The input is read from standard input and consists of two lines:

  1. The first line contains two integers N and K, where N is the number of elements in the array.
  2. The second line contains N space-separated integers representing the array.

outputFormat

Output a single line to the standard output: YES if there exists a pair of distinct elements whose sum is K; otherwise, output NO.

## sample
5 9
2 7 11 15 1
YES