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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#include <bits/stdc++.h>
#include <unordered_map>

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define FORD(i,a,b) for(int i = (a); i >= (b); i--)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define M_PI 3.14159265358979323846
template<class C> void mini(C& _a4, C _b4) { _a4 = min(_a4, _b4); }
template<class C> void maxi(C& _a4, C _b4) { _a4 = max(_a4, _b4); }

template<class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
	while (*sdbg != ',')cerr << *sdbg++; cerr << '=' << h << ','; _dbg(sdbg + 1, a...);
}

template<class T> ostream& operator<<(ostream& os, vector<T> V) {
	os << "["; for (auto& vv : V) os << vv << ","; os << "]";
	return os;
}

template<class T> ostream& operator<<(ostream& os, set<T> V) {
	os << "["; for (auto& vv : V) os << vv << ","; os << "]";
	return os;
}

template<class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) {
	return os << "(" << P.st << "," << P.nd << ")";
}


#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#endif

VI inp;
VI procInp;
vector<VI> pots;
int k, n;
int thresN;
int res = 1;

const int mxN = 1e18;

VI myPos;
VI procMyPos;

int myLog(int base, int x) {
	auto it = upper_bound(ALL(pots[base]), x);
	it--;
	return it - pots[base].begin();
}

#define LIKELY(condition) __builtin_expect(static_cast<bool>(condition), 1)
#define UNLIKELY(condition) __builtin_expect(static_cast<bool>(condition), 0)

void bt(int idx, int cur) {
	if (idx == k) {
		int l = 0, r = SZ(myPos) - 1;
		while (l < r) {
			int m = (l + r + 1) >> 1;
			if (cur <= procMyPos[m]) {
				l = m;
			}
			else {
				r = m - 1;
			}
		}
		cur *= myPos[l];
		maxi(res, cur);
		return;
	}
	while (true) {
		bt(idx + 1, cur);
		if (cur > procInp[idx])
			break;
		cur *= inp[idx];
	}
}

const int magic = 50;
vector<PII> baby;
vector<int> preBaby;
void bt2(int idx, int cur) {
	if (idx == k) {
		myPos.push_back(cur);
		return;
	}
	int v = baby[idx].first;
	int co = baby[idx].second;
	REP(i, co) {
		bt2(idx + 1, cur);
		if (cur > preBaby[idx]) {
			break;
		}
		cur *= v;
	}
}

int32_t main(int32_t argc, char ** argv) {
	ios_base::sync_with_stdio(0);
	cin >> k >> n;
	inp.resize(k, 1);
	procInp.resize(k);
	pots.resize(k);
	preBaby.resize(k);
	REP(i, k) {
		int tmp;
		cin >> tmp;
		int co = 0;
		while (inp[i] < magic) {
			inp[i] *= tmp;
			co++;
		}
		baby.PB({ tmp, co });
	}
	sort(ALL(baby));
	sort(ALL(inp));
	REP(i, k) {
		procInp[i] = n / inp[i];
	}
	REP(i, k){
		preBaby[i] = n / baby[i].st;
	}
	myPos.reserve((int)4.5e5);
	bt2(0, 1);
	sort(ALL(myPos));
	procMyPos.resize(SZ(myPos));
	REP(i, SZ(myPos)){
		procMyPos[i] = n / myPos[i];
	}
	
	const int mx = LLONG_MAX;
	bt(0, 1);
	cout << res << "\n";
}