Skip to main content
Thursday (26.11.2026) at 20:00: ALGOR Contest: Round #5 starts!

~/algor $ cat problems/ikki-korsatkich-yigindisi-x-juftlik

Pair with sum x

Easy 1000 ms 128 MB 29%
Share

A positive integer $n$, $n$ integers $a_{1}, a_{2}, \dots, a_{n}$ sorted in non-decreasing order and an integer $x$ are given. If the array has two elements at different positions ($i \lt j$) whose sum equals $x$, print YES, otherwise NO:

$$a_{i} + a_{j} = x$$

Two elements of the sorted array with sum x

Input

The first line contains two integers: $n$ and $x$. The second line contains $n$ integers $a_{i}$ in non-decreasing order.

Output

YES or NO accordingly.

Note

$2 \le n \le 2 * 10^{5}$
$-10^{9} \le a_{i} \le 10^{9}$
$-2 * 10^{9} \le x \le 2 * 10^{9}$

Examples

Input #1
5 13
1 4 6 9 11
Output #1
YES
Input #2
4 3
1 1 5 8
Output #2
NO

Sign in to submit a solution

Signing up is free and takes a minute.