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
/*
 * ILO
 * Autor: Szymon Tur
 */

#include <iostream>
#include <cmath>

using namespace std;

int k=0;
long long n=0;
//int p[] = {2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97} (25)
int * zb;

long long maxl=0;

void znl(long long x)
{
	for (int i=0;i<k;i++)
	{
		if (x*zb[i]<=n) znl(x*zb[i]);
		else //zn. dost. duza
		{
			maxl = x > maxl ? x : maxl;
			return;
		}
	}
}

int main()
{
	cin >> k >> n;
	zb = new int[k];
	for (int i=0;i<k;i++)
	{
		cin >> zb[i];
	}
	if (n==1)
	{
		cout << "1";
		delete [] zb;
		return 0;
	}
	if (k<=3)
	{
		znl(1);
		cout << maxl;
		

		delete [] zb;
		return 0;
	}
	long long x;
	for (long long i=n;i>0;i--)
	{
		x=i;
		for (int j=0;j<k;j++)
		{
			while (x%(long long)zb[j]==0) x/=(long long)zb[j];
		}
		if (x==1)
		{
			cout << i;
			delete [] zb;
			return 0;
		}
	}
	
	cout << "1";
	
	


	delete [] zb;
	return 0;

}