AlgoUniversity
  • Go Back
Discussion
Big Prime Number :

Author

Ayush Gangwani

Difficulty Level : Hard

Submissions : 202

Asked In : Nagarro

Marks :20

: 2 | : 0

You are given a set of $$$n$$$ distinct prime numbers. You can make a new number by multiplying these numbers with each other. You can use any prime number as many times as you want.

Your task is to find the $$$k^{th}$$$ smallest number that you can make with the given set of prime numbers.

Input

The first line of input contains two space seperated integers $$$n$$$ $$$(1 \le n \le 100)$$$ and $$$k$$$ $$$(1 \le k \le 10^5)$$$ — the number of primes in the set and the number $$$k$$$ specified in the problem.

The next line contains $$$n$$$ space separated integers given in ascending order denoting the elements of the set. It is guaranteed that the elements are distinct primes and do not exceed $$$10^3$$$.

Output

Print a single integer — the $$$k^{th}$$$ smallest number you can make with the given set of prime numbers.

Examples

Input
3 3
2 3 5
Output
4
Input
4 11
2 7 13 19
Output
32

Note

In sample testcase 1, the sequence of numbers that you can make with the given set of prime numbers is $$$2,3,4,5,6..$$$., hence the output is 4.

In sample testcase 2, the sequence of numbers that you can make with the given set of prime numbers is $$$2,4,7,8,13,14,16,19,26,28,32...$$$, hence the output is 32.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.