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
48
49
50
51
52
53
54
55
56
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (b) - 1; i <= (a); i--)

int k;
ll n;
ll lim;
vector<int>p;
vector<int>res;

void rec(int i, ll m) {
	bool first = true;
	while (m <= lim) {
		if (!first)
			res.push_back(m);
		first = false;
		if (i < k - 1)
			rec(i + 1, m);
		m *= p[i];
	}
}

ll prod(ll a, ll b) {
	return a * b;
}
//	int ca = 64 - __builtin_clzll(a), cb = 
int main(void)
{
	ios::sync_with_stdio(false);
	cin >> k>>n;
	p.resize(k, -1);
	rep(i, 0, k)
		cin >> p[i];
	sort(p.begin(), p.end());
	lim = min(((ll)(sqrt(n + 100) + 100) * p.back()), n);
	rec(0, 1);
	sort(res.begin(), res.end());
	int l = res.size();
	int ptr = l - 1;
	ll best = 0;
	rep(i, 0, l) {
		ll p = res[i];
		ll div = n / p;
		while (ptr && res[ptr] > div)
			ptr--;

		if (p * res[ptr] < n)
			best = max(best, p * res[ptr]);
	}

//	cout << res.size()<<"\n";
	cout <<best<<"\n";
}