#C4440. Pair with Specific Difference

    ID: 47979 Type: Default 1000ms 256MiB

Pair with Specific Difference

Pair with Specific Difference

Given an array of n integers, determine whether there exists a pair of distinct elements whose absolute difference is exactly k. In other words, find two indices i and j (i ≠ j) such that:

\(|a_i - a_j| = k\)

The input is read from stdin and the output is written to stdout. If such a pair exists, print Yes; otherwise, print No. Special attention is needed when k = 0: in that case, the pair must consist of two occurrences of the same number.

inputFormat

The first line contains two space-separated integers: n (the number of elements in the array) and k (the required absolute difference).

The second line contains n space-separated integers representing the array elements.

outputFormat

Print a single line containing Yes if there exists a pair of distinct elements with an absolute difference of k, otherwise print No.

## sample
5 3
1 4 7 2 9
Yes