# Ignoring Digits

When representing a number in decimal format, we need the ten digits ‘0’ to ‘9’. If we are only allowed to use a subset of the ten decimal digits, there is only a limited number of numbers we can represent. If, for example, we only can use the digits ‘1’ and ‘2’, the numbers 11 and 12 can be represented, but the number 13 can not. If we scan the multiples of 13: 13, 26, 39, 52, 65, 78, 91, 104, 117, 130, 143, 156, 169, 182, 195, 208, 221, etc., we see that 221 is the smallest multiple of 13 that can be represented using only the digits ‘1’ and ‘2’. In this problem you are asked to give the smallest multiple of a certain number that can be repre- sented using a given subset of the decimal digits. This multiple can be the number itself, but it has to be greater than zero. Input The input consists of several cases, each on a line by itself. Each line has two numbers F and N. F is a number composed of the digits you are allowed to use in the representation. It has a minimum of 1 and a maximum of 10 unique digits in descending order. N is the number for which you are to find the multiple. It is greater than zero, but smaller than 100000. A line with two zeros ends the input and should not be processed. Output For every case in the input, one line containing the smallest multiple of N that can be represented using the digits in F. If such a multiple of N doesn’t exist, print the word ‘impossible’ (without the quotes). Never print leading zeros. Sample Input 1 11 21 12 21 13 9876543210 12345 43210 56789 97531 2 00 Sample Output 11 12 221 12345 1022202 impossible