#P11128. Exact Difference Pair

    ID: 13188 Type: Default 1000ms 256MiB

Exact Difference Pair

Exact Difference Pair

You are given n positive integers representing the difficulties of n levels. You are also given a positive integer k.

Your task is to determine whether there exist two levels such that the absolute difference of their difficulties is exactly \(k\). If such a pair exists, output Yes; otherwise, output No.

Formally, given an array \(a_1, a_2, \dots, a_n\), determine if there exist indices \(i\) and \(j\) (\(i \neq j\)) such that \(|a_i - a_j| = k\).

inputFormat

The first line contains two space-separated integers n and k (n denotes the number of levels and k is the target difference).

The second line contains n space-separated positive integers \(a_1, a_2, \ldots, a_n\), where \(a_i\) represents the difficulty of the \(i\)-th level.

outputFormat

Output a single line containing Yes if there exists a pair of levels with an absolute difference exactly equal to \(k\); otherwise, output No.

sample

5 3
1 5 3 4 2
Yes