Modulus Jockey
Submit solution
Points:
1
Time limit:
1.0s
Memory limit:
256M
Author:
Problem type
Allowed languages
C++, Java, Python
Craig has a list of unique numbers and an infinite number line. For each value
in his list, he highlights all multiples of
on the number line. Once he's done, he asks you what the
th smallest number he highlighted was. Can you help him?
Input
The first line contains two integers, and
(
,
), indicating that there are
elements in your Craig's list, and he wants to find the
th highlighted number.
The next line contains integers,
(
), the elements of Craig's list.
Output
Output the value of the th smallest number Craig has highlighted.
Example
Input 1
2 8
3 5
Output 1
18
Craig highlighted every 3rd and 5th number, so is the
th highlighted number on the number line.

Input 2
3 15
2 3 5
Output 2
21
Input 3
7 10
2 4 6 8 10 12 14
Output 3
20
Input 4
1 1000000000
1000000000
Output 4
1000000000000000000
Comments