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
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int k, km, kd, ile, ile2, b, e, sr;
long long N, a, res;

long long p[30];
long long male[30];
long long duze[30];

int v1[32132];
long long v2[926329];

void funkcja_male (int nr, long long a)
{
	if (nr < km)
	{
		funkcja_male(nr + 1, a);
		while (N / male[nr] >= a)
		{
			a *= male[nr];
			funkcja_male(nr + 1, a);
		}
	}
	else
	{
		if (a <= 2000000000)
		{
			v1[ile] = a;
			ile++;
		}
		else
		{
			v2[ile2] = a;
			ile2++;
		}
	}
}

void funkcja_duze (int nr, long long a)
{
	if (nr < kd)
	{
		funkcja_duze(nr + 1, a);
		while (N / duze[nr] >= a)
		{
			a *= duze[nr];
			funkcja_duze(nr + 1, a);
		}
	}
	else
	{
		if (N / a >= v2[0])
		{
			b = 0;
			e = ile2;
			while (b < e)
			{
				sr = (b + e + 1) >> 1;
				if (N / a >= v2[sr]) b = sr;
				else e = sr - 1;
			}
			if (a * v2[b] > res) res = a * v2[b];
		}
		else
		{
			b = 0;
			e = ile;
			while (b < e)
			{
				sr = (b + e + 1) >> 1;
				if (N / a >= v1[sr]) b = sr;
				else e = sr - 1;
			}
			if (a * (long long)(v1[b]) > res) res = a * (long long)(v1[b]);
		}
	}
}

int main ()
{
	scanf("%d%lld", &k, &N);
	res = 1;
	for (int i = 0; i < k; ++i) scanf("%lld", &p[i]);
	sort(p, p + k);
	for (int i = 0; i < k; ++i)
	{
		if (i < 6)
		{
			male[km] = p[i];
			km++;
		}
		else
		{
			duze[kd] = p[i];
			kd++;
		}	
	}
	funkcja_male(0, 1);
	sort(v1, v1 + ile);
	ile--;
	sort(v2, v2 + ile2);
	v2[ile2] = 1000000000000000001LL;
	funkcja_duze(0, 1);
	printf("%lld\n", res);
	return 0;
}