PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#TP0000018. Có tồn tại cặp số chênh lệch X? (Gap Existence)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Có tồn tại cặp số chênh lệch X? (Gap Existence)

Gap Existence

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

You are given an integer array A=(a1,a2,…,an)A=(a_1,a_2,\ldots,a_n) and an integer XX.

Determine whether two indices i,ji,j in the range from 11 to nn exist such that ai−aj=Xa_i-a_j=X. The indices are allowed to be equal, meaning the same element can be used twice. Both XX and array elements may be negative, zero, or positive.

Input

The first line contains integers n,Xn,X: the array length and the required difference.

The second line contains exactly nn integers a1,a2,…,ana_1,a_2,\ldots,a_n.

Output

Print Yes if such indices exist; otherwise print No. Use exactly the displayed capitalization.

Subtasks

  • Subtask 1 (20 points): 2≤n≤122\le n\le 12; −109≤X≤109-10^9\le X\le10^9; −109≤ai≤109-10^9\le a_i\le10^9 for all 1≤i≤n1\le i\le n; indices i=ji=j are allowed.
  • Subtask 2 (30 points): 2≤n≤20002\le n\le 2000; −109≤X≤109-10^9\le X\le10^9; −109≤ai≤109-10^9\le a_i\le10^9 for all 1≤i≤n1\le i\le n; indices i=ji=j are allowed.
  • Subtask 3 (50 points): 2≤n≤2000002\le n\le 200000; −109≤X≤109-10^9\le X\le10^9; −109≤ai≤109-10^9\le a_i\le10^9 for all 1≤i≤n1\le i\le n; indices i=ji=j are allowed.

Examples

Input

6 5
3 1 4 1 5 9

Output

Yes

Explanation

Choose i=6i=6 and j=3j=3. Then Ai−Aj=9−4=5=XA_i-A_j=9-4=5=X, so the answer is Yes. The indices are allowed to be identical; in particular, when X=0X=0, taking i=ji=j always works.