URI Online Judge | 1909

Help Kiko

By Dâmi Henrique, Inatel BR Brazil

Timelimit: 1

After asking for a square ball to his mother, Kiko did not receive just one, but several birthday balls! Kikos loves to drop multiple balls at once on the ground and keep watching them bounce. As the balls have size, weight and are made of different materials, the bounce time from one to another is variable. In this problem we will assume that every ball bounces infinitely according to its bouncing time.

Kiko released at the same time N balls and realized that depending on the bounce time of the balls, in a few moments, all the balls bounce at the same time, and he loved it!

Given the bounce time in seconds of the N balls that Kiko choose and a time T, which is the second that Kiko wants all the balls bounce together, your task is to find the lowest bounce time for another ball so all the N + 1 balls, when they are released together, all of them will bounce at the same time for the first time exactly in the second T.

The bouncing time that you will choose can’t be identical to any previously chosen by Kiko and should be greater than 1.

Bounce time is the difference of the time that the ball touch the ground twice in succession. If a ball has bounce time = 4, we will consider that it will bounce at seconds 4, 8, 12, 16...


There will be several test cases. The first line of each case begins with two integers N (1 ≤ N ≤ 100) and T (1 ≤ T ≤ 105) representing the amount of balls that Kiko has and the second that Kiko want to see the N+1 bouncing at the same time for the first time. On the next line, N integers in the range [1, T] follows, representing the bounce time of each ball.

The input ends with N = T = 0, which should not be processed.


For each case, output the bounce time of the ball that you choose, or "impossivel" if there doesn’t exist a ball that will satisfy Kiko’s whishes.

Input Sample Output Sample

2 12

2 4

2 20

3 2

3 100

4 5 20

0 0