Mrs. Krasteva is known to be very good at guessing the number of people in her class that get a score of 5 on the AP exam. So good in fact that she has always been correct or 1-2 students off. Everyone wants to know her current guess so she has a challenge for you.
She will give you a list of numbers in which each number on the list produces the same remainder when dividing the unknown number of people. You will also be given the value of the remainder . She also says that the number of people is the smallest possible number greater than its divisors which satisfies these conditions.
Find the number of people that score a 5 on the AP exam!
The first line will contain the amount of numbers and the shared remainder
The next lines will contain a number which produces the remainder when dividing the number of people.
Output the smallest number of people that score a 5 on the AP exam , satisfying the constraint that the number of people must not be less than .
Subtask 1 [40%]
Subtask 2 [30%]
Subtask 3 [30%]
Sample Input 1
2 4 5 6
Sample Output 1
Sample Input 2
5 10 20 66 43 34 45
Sample Output 2