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
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SIZE(a) ((int)a.size())

typedef long long ll;
const ll linf = 2e18;

const int N = 55;
const int M = 1900000;

ll n;
ll result = 0;
int m, a[N];
int h1[M], s1, s2;
int cnt1, cnt2;
int L, R;
int two = 0;
vector<int> f;
int big = 0;

void gen1(int pos, int now, int lim, vector<int>& a, int l, int r) {
	if (now > n || now > lim) return;
	if (pos == SIZE(f)) {
		if (cnt1 >= l && cnt1 < r) h1[s1++] = now;
		++cnt1;
		return;
	}
	if (now <= lim/a[pos]) gen1(pos, now*a[pos], lim, a, l, r);
	gen1(pos+1, now, lim, a, l, r);
}

void gen1(int block) {
	cnt1 = s1 = 0;
	gen1(0, 1, 2000000000, f, block*M, (block+1)*M);
	sort(h1, h1 + s1);
}

main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> m >> n;
	REP(i, m) {
		cin >> a[i];
		if (a[i] == 2) {
			two = 1;
			continue;
		}
		f.push_back(a[i]);
	}
	vector<int> now = f;
	now.push_back(1);
	reverse(now.begin(), now.end());
	gen1(0);
	REP(j, 61) {
		if (!two && j) break;
		REP(w, SIZE(now)) {
			ll cur = n/now[w];
			int iter = upper_bound(h1, h1 + s1, (cur >> j)) - h1 - 1;
			REP(i, s1) {
				while (iter >= 0 && 1LL*h1[i]*h1[iter] > (cur>>j)) --iter;
				if (iter < i) break;
				result = max(result, 1LL*h1[i]*h1[iter]*now[w]<<j);
			}
		}
	}
	cout << result << '\n';

	return 0;
}