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
181
182
183
// region standard
#include <bits/stdc++.h>
#define guard(x) if (!(x))
using namespace std;

#define _CAT(A, B) A ## B
#define CAT(A, B) _CAT(A, B)
#define _STR(...) #__VA_ARGS__
#define STR(...) _STR(__VA_ARGS__)
#define _FIRST(F, ...) F
#define FIRST(...) _FIRST(__VA_ARGS__, )
#define SKIP1(F, ...) __VA_ARGS__
#define SKIP2(F, ...) SKIP1(__VA_ARGS__, )
#define SKIP3(F, ...) SKIP2(__VA_ARGS__, )
#define SKIP4(F, ...) SKIP3(__VA_ARGS__, )
#define SKIP5(F, ...) SKIP4(__VA_ARGS__, )
#define SKIP6(F, ...) SKIP5(__VA_ARGS__, )
#define SKIP7(F, ...) SKIP6(__VA_ARGS__, )
#define SKIP8(F, ...) SKIP7(__VA_ARGS__, )
#define SKIP9(F, ...) SKIP8(__VA_ARGS__, )
#define SKIP10(F, ...) SKIP9(__VA_ARGS__, )
#define SKIP11(F, ...) SKIP10(__VA_ARGS__, )
#define SKIP12(F, ...) SKIP11(__VA_ARGS__, )
#define SKIP(N, ...) CAT(SKIP, N)(__VA_ARGS__, )
#define COUNT(...) FIRST(SKIP12(__VA_ARGS__, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, ))
#ifdef DEBUG
    #define MAGIC do { std::clog << boolalpha; } while(0)
    #define PRINT(msg) do { std::clog << "DBG:" << __LINE__ << ">  " << msg << std::endl; } while(0)
#else
    #define MAGIC do { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } while(0)
    #define PRINT(msg) do { } while(0)
#endif
#define _DBG1(x, ...) STR(x) << ": " << (x)
#define _DBG2(x, ...) STR(x) << ": " << (x) << " \t" << _DBG1(__VA_ARGS__)
#define _DBG3(x, ...) STR(x) << ": " << (x) << " \t" << _DBG2(__VA_ARGS__)
#define _DBG4(x, ...) STR(x) << ": " << (x) << " \t" << _DBG3(__VA_ARGS__)
#define _DBG5(x, ...) STR(x) << ": " << (x) << " \t" << _DBG4(__VA_ARGS__)
#define _DBG6(x, ...) STR(x) << ": " << (x) << " \t" << _DBG5(__VA_ARGS__)
#define _DBG7(x, ...) STR(x) << ": " << (x) << " \t" << _DBG6(__VA_ARGS__)
#define _DBG8(x, ...) STR(x) << ": " << (x) << " \t" << _DBG7(__VA_ARGS__)
#define _DBG9(x, ...) STR(x) << ": " << (x) << " \t" << _DBG8(__VA_ARGS__)
#define _DBG10(x, ...) STR(x) << ": " << (x) << " \t" << _DBG9(__VA_ARGS__)
#define _DBG11(x, ...) STR(x) << ": " << (x) << " \t" << _DBG10(__VA_ARGS__)
#define _DBG12(x, ...) STR(x) << ": " << (x) << " \t" << _DBG11(__VA_ARGS__)
#define _DBG(...) CAT(_DBG, COUNT(__VA_ARGS__))(__VA_ARGS__, )
#define DBG(...) PRINT(_DBG(__VA_ARGS__))
#define PDBG(msg, ...) PRINT(msg << _DBG(__VA_ARGS__))

#define ST first
#define ND second
#define EM emplace
#define EB emplace_back
#define IN insert
#define PB push_back
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using VI = vector<int>;
using VLL = vector<ll>;
#define ALL(x) (x).begin(), (x).end()
#define PAL(p) p.first, p.second
#define FI(e, v) for (auto const & e : v)
#define RP(n) FR(CAT(i_, CAT(n, _i)), n)
#define FV(i, s, n) for (int i = s; i > (int)(n); --i)
#define FS(i, s, n) for (int i = s; i < (int)(n); ++i)
#define FR(i, n) FS(i, 0, n)
#define RV(i, s, n) for (int i = s; i >= (int)(n); --i)
#define RS(i, s, n) for (int i = s; i <= (int)(n); ++i)
#define RR(i, n) RS(i, 1, n)

template<typename T>
inline T mini(T & a, T const & b) {
    return a = min(a, b);
}
template<typename T>
inline T maxi(T & a, T const & b) {
    return a = max(a, b);
}

template<typename T, typename... Args>
ostream & operator << (ostream & os, vector<T, Args...> const & V) {
    bool f = false;
    FI(e, V) {
        if (f) { os << ", "; }
        f = true;
        os << e;
    }
    return os;
}
template<typename T, typename... Args>
ostream & operator << (ostream & os, set<T, Args...> const & S) {
    bool f = false;
    FI(e, S) {
        if (f) { os << ", "; }
        f = true;
        os << e;
    }
    return os;
}
// endregion


struct Input {
    int k = 0;
    ll N;
    VLL P;

    friend istream & operator >> (istream & is, Input & self) {
        auto & k = self.k;
        auto & N = self.N;
        auto & P = self.P;

        is >> k >> N;

        P.resize(k);
        FR(i, k) {
            is >> P[i];
        }

        return is;
    }
};

struct Output {
    ll a;

    Output (ll _a) : a(_a) { }

    friend ostream & operator << (ostream & os, Output const & self) {
        return os << self.a;
    }
};


VI Q;
ll mx = 1;

set<ull> odw;

ull ha() {
    ull h = 0;
    FI(q, Q) {
        h *= 60;
        h += q;
    }
    return h;
}

void DFS(ll p, ll const & N, VLL const & P) {
    auto const & h = ha();
    if (odw.find(h) != odw.end()) { return; }
    odw.EM(h);

    DBG(p, Q);
    maxi(mx, p);

    FR(i, Q.size()) {
        auto m = p * P[i];
        if (m > N || p != m / P[i]) { break; }
        ++Q[i];
        DFS(m, N, P);
        --Q[i];
    }
}

Output algo(Input && input) {
    auto const & k = input.k;
    auto const & N = input.N;
    auto P = move(input.P);
    sort(ALL(P));
    Q.resize(k, 0);
    DFS(1, N, P);
    return mx;
}

#if __INCLUDE_LEVEL__ == 0
int main() {
    MAGIC;
    Input input;
    cin >> input;
    cout << algo(move(input));
}
#endif