P25406 [AtCoder] GCD Robot
普及+
题目描述

Problem Description

Takahashi has $ N $ robots. Each robot is numbered $ 1, 2, ..., N $.

Each robot has a positive integer written on it, and the robot numbered $ i $ has $ a_i $ written on it.

The robot numbered $ i $ will say "similar" if given positive integers $ X $ and $ Y $ such that ${\rm gcd}(X, a_i) = {\rm gcd}(Y, a_i)$, and "not similar" otherwise. Here, ${\rm gcd}(X, Y)$ denotes the greatest common divisor of $ X $ and $ Y $.

For positive integers $ X $ and $ Y $, if all $ N $ robots say "similar", we consider $ X $ and $ Y $ to be similar.

Given a positive integer $ Z $, find the smallest number that is similar to $ Z $.

Input Format

The input is given from the standard input in the following format:

$ N $ $ Z $ $ a_1 $ $ a_2 $ ... $ a_N $

Output Format

Output the answer.

Sample Input and Output

Sample Input #1

3 12
2 6 9

Sample Output #1

6

Sample Input #2

10 1000000007
1 2 3 4 5 6 7 8 9 10

Sample Output #2

1

Sample Input #3

2 1000000000000000000
1000000000000000000 1000000000000000000

Sample Output #3

1000000000000000000

Notes/Hints

Constraints

  • $ 1 ≦ N ≦ 100,000 $
  • $ 1 ≦ Z, a_i ≦ 10^{18} $

Sample Explanation 1

  • ${\rm gcd}(6, 2) = {\rm gcd}(12, 2) = 2$
  • ${\rm gcd}(6, 6) = {\rm gcd}(12, 6) = 6$
  • ${\rm gcd}(6, 9) = {\rm gcd}(12, 9) = 3$

Therefore, $ 6 $ and $ 12 $ are similar, and there is no number smaller than $ 6 $ that is similar to $ 12 $, so the answer is $ 6 $.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 12 2 6 9
样例输出
6