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
#include <algorithm>
#include <iostream>

unsigned long long result = 1;
unsigned char p[32];

void solve(unsigned long long n, unsigned long long m, unsigned char k) {
	if (n * m > result) {
		if (m > result)
			result = m;
		for (unsigned i = k; i; i--) {
			solve(n / p[i], m * p[i], i);
		}
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	unsigned k;
	unsigned long long n;
	std::cin >> k >> n;
	for (unsigned i = k; i; i--) {
		unsigned temp;
		std::cin >> temp;
		p[i] = temp;
	}
	p[0] = 0;
	std::sort(p, p + k + 1);
	solve(n, 1, k);
	std::cout << result << '\n';
	return 0;
}