Number ugly [Weak Weak Edition]

Number ugly [Weak Weak Edition]

Description

For a given prime number set S = {p1, p2, ..., pK}, the quality factor to consider all those belonging to the set S of numbers. This set includes: p1, p1p2, p1p1, and P1P2P3 (among others). This is for a number of ugly set input S. Note: We do not believe a number 1 is ugly. Your job is to find the set S input to the N-th set of ugly numbers. longint (signed 32-bit) is sufficient to program.

Input

Line 1: two compartments separated by an empty integer: K and N, 1 <= K <= 100, 1 <= N <= 100,000 Line 2:. K a is an integer of empty compartments separated: a collection of elements S

Output

A single line, the first number N to the S ugly write input.

Sample Input

4 19
2 3 5 7

Sample Output

27

HINT

Source

Guess you like

Origin www.cnblogs.com/LJA001162/p/12079323.html