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 #include using namespace std; typedef long long int LL; const int N = 2e5 + 9; LL n, n2; LL result = 0LL; int cnt; LL tab[N]; int k; int pm, stop; int primes[30]; inline LL kwa(LL a){ return a * a; } LL find(LL x){ if(tab[1] > x) return 1LL; int p = 1, k = cnt; while(p < k){ int m = (p + k + 1) >> 1; if(tab[m] <= x) p = m; else k = m - 1; } return tab[p]; } void add(int cur, int m){ if(cur == stop) return; if(1LL * m * primes[cur] <= n2){ add(cur, m * primes[cur]); tab[++cnt] = 1LL * m * primes[cur] * pm; add(cur + 1, m); } } void check(int cur, int m){ if(cur == stop) return; if(1LL * m * primes[cur] <= n2){ check(cur, m * primes[cur]); if(1LL * m * primes[cur] * pm >= n2) result = max(result, 1LL * m * primes[cur] * find(n / (1LL * m * primes[cur]))); check(cur + 1, m); } } int main(){ scanf("%d %lld", &k, &n); for(int i = 0; i < k; ++i) scanf("%d", &primes[i]); sort(primes, primes + k); n2 = sqrt(n); while(kwa(n2 + 1) <= n) ++n2; while(kwa(n2) > n) --n2; for(int i = 0; i < k; ++i){ tab[1] = 1; cnt = 1; pm = primes[i]; if(i < 9){ stop = i + 1; add(0, 1); } else{ stop = k; add(i, 1); } tab[1] *= pm; sort(tab + 1, tab + cnt + 1); if(i < 9){ stop = k; check(i, 1); } else{ stop = i + 1; check(0, 1); } result = max(result, find(n)); } printf("%lld\n", result); return 0; }