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

const int ac = 1e2 + 2;
int A[ac];

long long k, n;
long long f(long long c = 1, int u = 0)
{
	if (c > n) return 0;
	long long x = c;
	for (int i = u; i < k; i++)
	{
		if (n / A[i] + 10 <= c) continue;
		x = max(x, f(c * A[i], i));
	}
	return x;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> k >> n;
	for (int i = 0; i < k; i++) cin >> A[i];
	cout << f() << '\n';
}