QOJ.ac

QOJ

Time Limit: 4 s Memory Limit: 8 MB Total points: 10

#6017. Product [A]

Statistics

Given prime numbers $p_1, p_2, \dots, p_k$. Consider the set $A$ of positive integers whose prime factorization contains only these specified prime numbers. For example, if the given numbers are $2, 3, 7$, this set will be:

$A = \{1, 2, 3, 4, 6, 7, 8, 9, 12, 14, 16, 18, 21, 24, 27, 28, 32, 36, 42, 48, 49, 54, 56, 63, 64, 72, 81, 84, 96, 98, \dots\}$.

Johnny wrote down on a piece of paper all such numbers not exceeding $N$. What is the largest number he wrote?

Input

The first line contains two integers $k, N$ ($k \geq 1, 1 \leq N \leq 10^{18}$), representing the size of the set of prime numbers and the limit for the problem, respectively. The second line of input contains a sequence of $k$ pairwise distinct prime numbers $p_1, \dots, p_k$ ($2 \leq p_i \leq 100$) — the numbers generating the set $A$.

Output

In the only line of output, print a single natural number — the largest number that is in the set $A$ and does not exceed $N$.

Examples

Input 1

3 30
2 3 7

Output 1

28

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.