ALWFACT  Allowed Factors
Chico told his students that now they would be referenced by numerical codes of up to 12 digits in official communications (emails and tasks). And then he gave to each one of his students a card containing an unique number written on it. Quickly the students assumed that this would be their code, but to the surprise of the students and Levi's despair, Professor Chico explained that these were not their code.
A student's code was the term of an ordered sequence S that was in the position (indexed from 1) specified by the number on the card of each student. This sequence has a special feature: each term, when decomposed into prime factors, can only have numbers contained in a set of N elements written on the board by the teacher. And to make life even harder for Levi, those numbers would change every week in such a way that he will always have to recalculate his code if he doesn't want to delay his tasks.
Your task is to make a program to help Levi, so that given the prime numbers written on the board during the week by Professor Chico and number on the card, tell his weekly code.
Input
The input consists of several test cases. The first line of a test case contains two integers N (1 ≤ N ≤ 10^{2}) and M (1 ≤ M ≤ 10^{5}) representing respectively the number of numbers written by Professor Chico and the number written on the card. The second line contains N prime numbers P_{i }(2 ≤ P_{i} < 10^{6}), where P_{i} (1 ≤ i ≤ N) is a number written in the board. The entry ends when N=M=0.
Output
The output consists of one line per test case containing the Levi's weekly code.
Example
Input:2 1
2 3
2 10
2 3
3 10
2 3 5
3 10
3 7 13
0 0
Output:2
24
15
81
hide comments
David:
20210202 20:18:16
First Java AC! 

Scape:
20200617 18:06:22
This problem is a joke. Horrible statement (thanks @smso for clearing it up), weak input and no clarifications on the number of test cases.


smso:
20190926 08:00:24
Clearer statement:


pallindromeguy:
20190703 21:07:43
sorting the prime numbers in desc order gives AC and in ascending order gives TLE. Any reason why?


julkas:
20180603 11:46:46
Good problem and interesting results. 

absolute_coder:
20180528 15:03:20
could you tell ..No of test case ? 
Added by:  Francisco Elio Parente Arcos Filho [UEA] 
Date:  20180521 
Time limit:  0.100s1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: SQLITE 