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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//#include<bits/stdc++.h>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#define PII pair<int,int>
#define f first
#define s second
#define VI vector<LL>
#define LL long long
#define MP make_pair
#define LD long double
#define PB push_back
#define ALL(V) V.begin(),V.end()
#define abs(x) max((x),-(x))
#define PDD pair<LD,LD> 
#define VPII vector< PII > 
#define siz(V) ((int)V.size())
#define FOR(x, b, e)  for(int x=b;x<=(e);x++)
#define FORD(x, b, e) for(int x=b;x>=(e);x--)
#define REP(x, n)     for(int x=0;x<(int)(n);x++)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
using namespace std;
VI V;
LL n;
float nF = n;
vector<LL> all;
int cnt = 0;

inline void back1(LL x, int i)
    {
    if(x > n)return;
    if(i >= (int)V.size())return;
    if(all.back() != x)all.PB(x);
    if((float)x * V[i] > nF)return;
    
    back1(x, i+1);
    back1(x * V[i], i);
    }
void go1(VI VV, LL nn)
    {
    V = VV;
    n = nn;
    nF = n + 1e5;
    all = {1};
    back1(1, 0);
    sort(ALL(all));
    }
   
void check(LL);
LL prevv;
LL res = 1;
inline void back2(LL x, int i)
    {
    if(x > n)return;
    if(i >= (int)V.size())return;
    
//    fprintf(stderr, "%lld %lld %lld\n", res, n, x);
    if(n - (n%x) < res)return;     
    if(prevv != x)
        {
        check(x);
        prevv = x;
        }
    if((float)x * V[i] > nF)return;

    back2(x, i+1);
    back2(x * V[i], i);
    }
void go2(VI VV, LL nn)
    {
    V = VV;
    n = nn;
    nF = n + 1e5;
    back2(1, 0);
    }
    
LL en;
const int MXF = 5e4; // mała różnica 1e5-1e6
unsigned short int prep[MXF];

void do_prep()
    {    
    for(auto i : all)
        {
        if(i < MXF)
            prep[i] = i;
        }
    FOR(i, 1, MXF-1)
        {
        maxi(prep[i], prep[i-1]);
        }
    }

inline void check(LL x)
    {
    if(x > en)return;
    LL y = en/x;
        
    if(y < MXF)
        {
        maxi(res, x * prep[y]);
        return;
        }

    int idx = upper_bound(all.begin(), all.end(), y) - all.begin() - 1;
    maxi(res, all[idx] * x);
    }
    
void calculate(VI p, LL n)
    {
    en = n;
    sort(ALL(p));
    VI v[2];
    REP(i, p.size())
        v[(1-(i&1)) || i==1 || i==7].PB(p[i]);        
    go1(v[0], n + 1);
    do_prep();
    go2(v[1], n + 1);
    
/*
    REP(u, 2)
        {
        for(auto i : v[u])cerr<<i<<" ";
        cerr<<endl;
        }*/
    fprintf(stderr, "allsize: %d\n", all.size());
    /*
    cerr<<"all.size(): "<<all.size()<<endl;
    cerr<<"c1, c2 "<<c1<<" "<<c2<<endl;    
*/
    printf("%lld\n", res);
    }
    
void max_test();   
VI primes(int);
int main()
    {
    all.reserve(540000);
//    max_test();return 0;
    
    int k;
    LL n;
    
    scanf("%d%lld", &k, &n);
    VI p;
    REP(i, k)
        {
        int a;
        scanf("%d", &a);
        p.PB(a);
        }
    calculate(p, n);
    }

// **************************************************

void max_test()
    {
    LL n = 1e18;
    VI p = primes(100);
    calculate(p, n);
    }

bool prime(int x)
    {
    FOR(i, 2, x-1)
        {
        if(x % i == 0)return 0;
        }
    return 1;
    }
VI primes(int x)
    {
    VI V;
    FOR(i, 2, x)
        if(prime(i))
            V.PB(i);
    return V;
    }