Periodical cicadas

Given cycle lengths that already coincide within L, choose the smallest extra cycle maximizing the next common multiple not exceeding L.

Hard8Number theoryMathBinary searchNo attempts yetTime limit1sMemory limit1024 MB

Problem

The North American periodical cicadas have the longest life cycle among known insects. Every 17 years they mature, mate, lay eggs, and die. The newly hatched young burrow 20 centimeters underground, feed on root sap for 17 years, and come out when their turn arrives.

The number 17 is believed not to be an accident. Another cicada species in the same region runs on a 13 year cycle, so the two species emerge in the same year only once every 221 years. The chance that the two species mix drops sharply, and the traits of one population do not enter the other.

A variant of an evolutionary algorithm borrows this idea. In its last stage the best candidate solutions are split into populations, and population ii gets a life cycle CiC_i. One extra population is then added, and its period is chosen so that the number of iterations until every life cycle coincides again is as large as possible. The populations are evaluated until all life cycles coincide, and the best solution at that moment is taken. Waiting too long for an answer is useless, so the number of iterations also has an upper bound LL.

Given the life cycles of the populations and the iteration limit LL, compute the optimal period for the extra population.

Input

The first line contains two integers NN and LL. NN is the number of populations produced by the earlier stages and LL is the limit on the number of iterations (2N1042 \le N \le 10^4, 1L1061 \le L \le 10^6).

The second line contains the NN values CiC_i, the length in iterations of each population's life cycle (1Ci1 \le C_i). The life cycles of the current populations coincide within LL iterations.

Output

Print on one line the period of the extra population that maximizes the number of iterations TT until the life cycles of all populations coincide, under the condition TLT \le L. If several periods reach that maximum, print the smallest one.