#arc126c. [arc126_c]Maximize GCD

[arc126_c]Maximize GCD

Problem Statement

Given is a sequence of NN positive integers: A=(A1,A2,ldots,AN)A = (A_1, A_2, \\ldots, A_N). You can do the following operation on this sequence at least zero and at most KK times:

  • choose iin1,2,ldots,Ni\\in \\{1,2,\\ldots,N\\} and add 11 to AiA_i.

Find the maximum possible value of gcd(A1,A2,ldots,AN)\\gcd(A_1, A_2, \\ldots, A_N) after your operations.

Constraints

  • 2leqNleq3times1052\\leq N\\leq 3\\times 10^5
  • 1leqKleq10181\\leq K\\leq 10^{18}
  • 1leqAileq3times1051 \\leq A_i\\leq 3\\times 10^5

Input

Input is given from Standard Input in the following format:

NN KK A1A_1 A2A_2 ldots\\ldots ANA_N

Output

Print the maximum possible value of gcd(A1,A2,ldots,AN)\\gcd(A_1, A_2, \\ldots, A_N) after your operations.


Sample Input 1

3 6
3 4 9

Sample Output 1

5

One way to achieve gcd(A1,A2,A3)=5\\gcd(A_1, A_2, A_3) = 5 is as follows.

  • Do the operation with i=1i = 1 twice, with i=2i = 2 once, and with i=3i = 3 once, for a total of four times, which is not more than K=6K=6.
  • Now we have A1=5A_1 = 5, A2=5A_2 = 5, A3=10A_3 = 10, for which gcd(A1,A2,A3)=5\\gcd(A_1, A_2, A_3) = 5.

Sample Input 2

3 4
30 10 20

Sample Output 2

10

Doing no operation achieves gcd(A1,A2,A3)=10\\gcd(A_1, A_2, A_3) = 10.


Sample Input 3

5 12345
1 2 3 4 5

Sample Output 3

2472