#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) #define repr(i, n) for (int i = (n) - 1; i >= 0; i--) #define repe(i, l, r) for (int i = (l); i < (r); i++) #define reper(i, l, r) for (int i = (r) - 1; i >= (l); i--) #define repi(i, l, r) for (int i = (l); i <= (r); i++) #define repir(i, l, r) for (int i = (r); i >= (l); i--) #define range(a) a.begin(), a.end() void initio() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } bool can[500001]; set< vector > st; bitset<500001> dp[1 << 11]; bitset<500001> checked[1 << 11]; int N; ll A[500010]; ll prod[1 << 11]; int root[1 << 11]; int cnt; ll X; clock_t beg; bool dfs(int x, int u) { u = root[u]; if (checked[u][x]) return dp[u][x]; cnt++; checked[u][x] = true; if (prod[u] - 1 > x) return dp[u][x] = false; if ((u & u - 1) == 0) return dp[u][x] = prod[u] - 1 == x; rep(i, N) if (u >> i & 1) { if ((x - (prod[u] - 1)) % A[i] == 0) return dp[u][x] = true; } for (int i = (u - 1) & u; i != 0; i = (i - 1) & u) { if (root[i] != i) continue; int j = u ^ i; for (int k = prod[j]; k <= x && prod[i] - 1 <= x / k; k++) if (x % k != 0) { if (dfs(x % k, j) && dfs(x / k, i)) { return dp[u][x] = true; } } } return dp[u][x] = false; } void dfs2(vector a) { if (a.size() == 1) { can[a[0]] = true; return; } sort(range(a)); if (st.count(a)) return; st.insert(a); ll p = 1; rep(i, a.size()) p *= a[i] + 1; can[p - 1] = true; rep(i, a.size()) repe(j, i + 1, a.size()) { auto tmp = a; ll x = a[i]; ll y = a[j]; tmp.erase(tmp.begin() + j); tmp.erase(tmp.begin() + i); ll pp = p; pp /= x + 1; pp /= y + 1; set nxt; for (ll t = y + 2; (x * t + y + 1) * pp - 1 <= X; t++) { nxt.insert(x * t + y); } for (ll t = x + 2; (y * t + x + 1) * pp - 1 <= X; t++) { nxt.insert(y * t + x); } for (ll t : nxt) { tmp.push_back(t); dfs2(tmp); tmp.pop_back(); } } } int main() { beg = clock(); cin >> N >> X; rep(i, N) cin >> A[i]; sort(A, A + N); ll p = 1; rep(i, N) { p *= A[i] + 1; if (p - 1 > X) { cout << string(X, '0') << endl; return 0; } } if (count(A, A + N, 1) > 0 && N >= 2) { string ans(X, '0'); for (int i = p - 1; i <= X; i++) { ans[i - 1] = '1'; } cout << ans << endl; return 0; } if (N <= 8) { dfs2(vector(A, A + N)); string ans(X, '0'); for (int i = 1; i <= X; i++) { if (can[i]) ans[i - 1] = '1'; } cout << ans << endl; return 0; } rep(i, 1 << N) prod[i] = 1; rep(i, 1 << N) rep(j, N) if (i >> j & 1) { prod[i] *= A[j] + 1; } rep(i, 1 << N) { vector a; rep(j, N) if (i >> j & 1) a.push_back(A[j]); int mask = 0; int k = 0; rep(j, N) { if (k < a.size() && a[k] == A[j]) { mask |= 1 << j; k++; } } root[i] = mask; } string ans(X, '0'); for (int i = p - 1; i <= X; i++) { if (dfs(i, (1 << N) - 1)) { ans[i - 1] = '1'; } } cout << ans << endl; cerr << cnt << endl; }