We call a sequence of non-negative integers, , awesome if there exists some positive integer such that each element in (where ) is evenly divisible by . Recall that evenly divides if there exists some integer such that .
Given an awesome sequence, , and a positive integer, , find and print the maximum integer, , satisfying the following conditions:
is also awesome.
The first line contains two space-separated positive integers, (the length of sequence ) and (the upper bound on answer ), respectively.
The second line contains space-separated positive integers describing the respective elements in sequence (i.e., ).
Print a single, non-negative integer denoting the value of (i.e., the maximum integer such that is awesome). As is evenly divisible by any , the answer will always exist.
Sample Input 0
2 6 4
Sample Output 0
The only common positive divisor of , , and that is is , and we need to find such that . We know because would not evenly divide . When we look at the next possible value, , we find that this is valid because it's evenly divisible by our value. Thus, we print .
Sample Input 1
Sample Output 1
Being prime, is the only possible value of . The only possible such that is (recall that ), so we print as our answer.