#P2527. [SHOI2001] Panda的烦恼

[SHOI2001] Panda的烦恼

Description

panda is a math geek who loves studying things that go against the grain. Recently, he has been looking into sieve methods. As is well known, after applying a sieve to integers in a range, the remaining numbers are all primes. But panda is not interested in those; he is only interested in the numbers that get crossed out. He believes that important cosmic secrets are hidden among these eliminated numbers, which people just have not discovered yet.

panda also thinks that simply sieving in ascending order is not enough to reveal the mystery, so he decides to study numbers that contain at most certain prime factors (for example, the numbers that contain at most the prime factors 2,32,3 are 2,3,4,6,8,9,2,3,4,6,8,9,\ldots). He needs to obtain the kk-th smallest among such numbers (kk is what panda calls the cosmic coefficient). Please write a program to help him find this number.

Input Format

The first line contains two integers n,kn,k, where nn is the number of prime factors, and kk is that cosmic coefficient.

The second line contains nn integers, representing these nn prime factors. Let the sequence formed by these primes be pp.

Output Format

Output a single line: the kk-th smallest positive integer that contains at most these nn prime factors. Denote this answer by ansans.

2 7
3 5
45


Hint

Sample explanation

The first six numbers are 3,5,9,15,25,273,5,9,15,25,27.

Constraints

For all testdata, 1n1001\le n\le 100, 1k1051\le k\le 10^5, piprimep_i\in\text{prime}, pi103p_i\le 10^3, pipj(ij)p_i\not=p_j(i\not=j), 1ans2×1091\le ans\le 2\times 10^9.

Translated by ChatGPT 5