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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for (int i = (a); i <= (b); ++i)
#define REPD(i,a,b) for (int i = (a); i >= (b); --i)
#define FORI(i,n) REP(i,1,n)
#define FOR(i,n) REP(i,0,int(n)-1)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define SZ(x) int((x).size())
#define DBG(v) cerr << #v << " = " << (v) << endl;
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define fi first
#define se second

const int K = 25;
const ll mx = 400000001LL;

ll pr[K];
int k;

int tot;
int q;
int all[1900100];

void rec(int p, ll v) {
	if (p==k) {
		all[q++] = v;
		return;
	}
	for (; v<mx; v*=pr[p]) {
		rec(p+1, v);
	}
}

int main() {
	ll n;
	ll res = 1;
	scanf("%d%lld", &k, &n);
	FOR(i,k) scanf("%lld", &pr[i]);
	rec(0, 1);
	sort(all, all+q);
	//fprintf(stderr, "%d\n", q);
	if (k==1) {
		for (int i=1; i<20; i++) {
			pr[k] = pr[k-1] * pr[0];
			if (pr[k]<=n) res = max(res, pr[k]);
			k++;
		}
	} else if (k==2) {
		FOR(i,4) FOR(j,4) if (i+j>1) {
			ll c=1;
			FOR(qq,i) {
				c*=pr[0];
				if (c>n) break;
			}
			FOR(qq,j) {
				c*=pr[1];
				if (c>n) break;
			}
			if (c<=n) {
				res = max(res, c);
				pr[k++] = c;
			}
		}
	}
	if (k<=6) {
		FOR(a,k) {
			int sti=q-1;
			FOR(b,k) {
				ll target = n/pr[a]/pr[b], mul = pr[a]*pr[b];
				while (sti>=0 && target < all[sti]) sti--;
				int j = 0;
				for (int i=sti; i >= 0; i--) {
					while (j<q && target/all[j] >= all[i]) j++;
					if (j>0) res = max(res, mul*all[i]*all[j-1]);
				}
			}
		}
	} else {
		FOR(a,k) {
			int sti=q-1;
			ll target = n/pr[a], mul = pr[a];
			while (sti>=0 && target < all[sti]) sti--;
			int j = 0;
			for (int i=sti; i >= 0; i--) {
				while (j<q && target/all[j] >= all[i]) j++;
				if (j>0) res = max(res, mul*all[i]*all[j-1]);
			}
		}
	}
	printf("%lld\n", res);
	return 0;
}