1494 : Subsequence GCD

时间限制Time Limit
1 秒Sec
内存限制Memory Limit
128 兆MB
提交次数Submitted
0 次Times
通过次数Solved
0 次Times

题目描述Description

You are given a sequence of positive integers A = (A_1,A_2,...,A_N) of length N and a positive integer M. Does there exist a non-empty and not necessarily continuous subsequence of A such that the greatest common divisor (GCD) of the subsequence is M? If yes, output “Yes”; if not, output “No”.

输入格式Input

The input is given from Standard Input in the following format:

N\ M (1\le N \le 2 * 10^5,\ 1\le M\le 10^9)

A_1\ A_2\ ...\ A_N(1\le a_i\le 10^9)

输出格式Output

Print Yes if exist a non-empty and not necessarily continuous subsequence of A such that the greatest common divisor (GCD) of the subsequence is M, and No otherwise.

样例Sample