By Kay Akashi
Given an integer and integers , …, , find the greatest common multiple of all the elements in which is smaller than or equal to . If there is no such answer, output instead.
Note that, common multiple of is the number which can be divided by any element in . Your task is to find the greatest one amongst several possible (or zero) common multiples.
, , .
The first line of input contains two integers, and . The second line contains integers separated by single spaces in between.
Output the answer.
3 100
2 3 5
90
In this example, common multiples of which are smaller than or equal to are . The greatest common multiple of here is therefore .
4 10
2 5 8 9
-1
In this example, the least common multiple is . This indicates that there's no common multiple that is smaller than or equal to . For this reason, output .