- Time limit: 2.00 s
- Memory limit: 512 MB
There are n plants in an array. The beauty of the the i'th plant is a_{i}. We call a contiguous subarray of the plants perfect
, iff the GCD of the beauties of the plants in the subarray is x. For example, if the plants in the subarray have beauties [6, 4, 10], the GCD is 2.
Does there exist any perfect contiguous subarray in the array?
Input
The first line has two integers n and x: the number of plants and the required GCD.
The second line contains n integers a_1, a_2,\dots,a_n: The beauties of the plants.
Output
Print YES if there is a subarray whose GCD is x and NO otherwise.
Constraints
- 1 \leq x, n, a_i \leq 10^5
Example 1
Input:
3 2 4 6 7
Output:
YES
Example 2
Input:
3 2 4 7 6
Output:
NO