#include #include #include #include #include #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; // const int MOD = 998244353; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; // const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1}, // dx[] = {0, -1, -1, -1, 0, 1, 1, 1}; struct IOSetup { IOSetup() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); cerr << fixed << setprecision(10); } } iosetup; /*-------------------------------------------------*/ void output(const vector &ans) { for (bool e : ans) cout << e; cout << '\n'; exit(0); } int main() { int n, x; cin >> n >> x; vector a(n); REP(i, n) cin >> a[i]; vector ans(x, false); if (n == 1) { if (a[0] <= x) ans[a[0] - 1] = true; output(ans); } if (n >= 19) output(ans); long long lb = 1; REP(i, n) { lb *= a[i] + 1; if (x < lb - 1) output(ans); } if (count(ALL(a), 1) > 0) { FOR(i, lb - 1 - 1, x) ans[i] = true; output(ans); } vector p(n + 1, 1); FOR(i, 1, n + 1) p[i] = p[i - 1] * 3; vector > dp(1 << n); REP(i, 1 << n) dp[i].assign(x / p[n - __builtin_popcount(i)], false); REP(i, n) { if (a[i] < dp[1 << i].size()) dp[1 << i][a[i]] = true; } FOR(i, 1, 1 << n) REP(j, n) { if (i >> j & 1) continue; int nx_i = i | (1 << j); vector tmp(dp[nx_i].size(), false); REP(k, dp[i].size()) { if (dp[i][k]) { long long par = (1LL + k) * (a[j] + 1) - 1; if (par < tmp.size()) tmp[par] = true; } } REP(k, tmp.size()) { if (tmp[k]) { dp[nx_i][k] = true; if (k + a[j] < tmp.size()) tmp[k + a[j]] = true; } } } FOR(j, 1, x + 1) ans[j - 1] = dp[(1 << n) - 1][j]; output(ans); }