1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <bits/stdc++.h>
#pragma GCC optimize("3")
#define ll long long int
using namespace std;

ll Best = 0;
ll Limit;
int czas = 0;
vector <ll> primes;
set<ll> lic;


inline void LICZREK(ll x, int s, int e) {
	Best = max(x, Best);
	czas++;
	for (int i = e - 1; i >= s; i--)
	{
		if (x*primes[i]<Limit)
		{
			LICZREK(x*primes[i], i, e);
		}
		else
		{
			e--;
		}
	}

}


int main() {
	ll n;
	int k;
	cin >> k >> n;
	Limit = n;
	for (int i = 0; i < k; i++)
	{
		int a;
		cin >> a;
		primes.push_back(a);
	}
	LICZREK(1, 0, k);
	cout << Best;
	//cout << "Czas " << czas;

	return 0;
}