#include int ri() { int n; scanf("%d", &n); return n; } std::string solve(int n, int x, const std::vector &a_) { auto a = a_; if (n == 1) { std::string s(x, '0'); if (a[0] <= x) s[a[0] - 1] = '1'; return s; } std::sort(a.begin(), a.end()); int64_t prod = 1; for (int i = 0; i < n; i++) { prod *= a[i] + 1; if (prod > x + 1) return std::string(x, '0'); } if (std::count(a.begin(), a.end(), 1)) { std::string res(x, '0'); for (int i = prod - 1; i <= x; i++) res[i - 1] = '1'; return res; } std::vector size(n + 1); // x / 3^i size[n] = x + 1; for (int i = n - 1; i >= 0; i--) size[i] = size[i + 1] / 3; std::vector > dp(1 << n); for (int i = 0; i < 1 << n; i++) dp[i].resize(size[__builtin_popcount(i)]); for (int i = 0; i < n; i++) assert(a[i] < (int) dp[1 << i].size()), dp[1 << i][a[i]] = true; for (int i = 0; i < 1 << n; i++) { int cur_sz = dp[i].size(); for (int j = 0; j < n; j++) { if (i >> j & 1) continue; std::vector tmp(dp[i | 1 << j].size()); for (int k = 0; k < cur_sz; k++) { int64_t target = (int64_t) (k + 1) * (a[j] + 1) - 1; if (dp[i][k] && target < (int) tmp.size()) tmp[target] = true; } for (int k = 0; k + a[j] < (int) tmp.size(); k++) if (tmp[k]) tmp[k + a[j]] = true; for (int k = 0; k < (int) tmp.size(); k++) if (tmp[k]) dp[i | 1 << j][k] = true; } } std::string res; for (int i = 1; i <= x; i++) res.push_back(dp.back()[i] ? '1' : '0'); return res; } int main() { int n = ri(), x = ri(); assert(1 <= n && n <= 100); assert(1 <= x && x <= 500000); std::vector a(n); for (int i = 0; i < n; i++) a[i] = ri(), assert(1 <= a[i] && a[i] <= x); clock_t r0 = clock(); std::cout << solve(n, x, a) << std::endl; clock_t r1 = clock(); std::cerr << (double)(r1 - r0) * 1000 / CLOCKS_PER_SEC << "ms" << std::endl; return 0; }