Codeforces Round 206 (Div. 1)
C
Vasya and Beautiful Arrays
Codeforces
2100
原题
← BD →
翻译中…

Vasya's got a birthday coming up and his mom decided to give him an array of positive integers $*a*$ of length $*n*$.

翻译中…

Vasya thinks that an array's beauty is the greatest common divisor of all its elements. His mom, of course, wants to give him as beautiful an array as possible (with largest possible beauty). Unfortunately, the shop has only one array $*a*$ left. On the plus side, the seller said that he could decrease some numbers in the array (no more than by $*k*$ for each number).

翻译中…

The seller can obtain array $*b*$ from array $*a*$ if the following conditions hold: $*b*_{*i*} > 0; 0 ≤ *a*_{*i*} - *b*_{*i*} ≤ *k*$ for all $1 ≤ *i* ≤ *n*$.

翻译中…

Help mom find the maximum possible beauty of the array she will give to Vasya (that seller can obtain).

翻译中…

Input

翻译中…

The first line contains two integers $*n*$ and $*k*$ $(1 ≤ *n* ≤ 3·10^{5}; 1 ≤ *k* ≤ 10^{6})$. The second line contains $*n*$ integers $*a*_{*i*}$ $(1 ≤ *a*_{*i*} ≤ 10^{6})$ — array $*a*$.

翻译中…

Output

翻译中…

In the single line print a single number — the maximum possible beauty of the resulting array.

翻译中…

Note

翻译中…

In the first sample we can obtain the array:

翻译中…

$3 6 9 12 12 15$

翻译中…

In the second sample we can obtain the next array:

翻译中…

$7 21 49 14 77$

翻译中…

样例

Input #1
6 1
3 6 10 12 13 16
Output #1
3
InputCopy OutputCopy
Input #2
5 3
8 21 52 15 77
Output #2
7
InputCopy OutputCopy
题目信息
题号
354C
时间限制
1 s
内存限制
256 MB
标签
暴力
动态规划
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。