#include // created [2019/12/11] 00:33:01 #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wsign-conversion" using i32 = int32_t; using i64 = int64_t; using u32 = uint32_t; using u64 = uint64_t; using uint = unsigned int; using usize = std::size_t; using ll = long long; using ull = unsigned long long; using ld = long double; template using arr = T (&)[n]; template using c_arr = const T (&)[n]; template constexpr T popcount(const T u) { return u ? static_cast(__builtin_popcountll(static_cast(u))) : static_cast(0); } template constexpr T log2p1(const T u) { return u ? static_cast(64 - __builtin_clzll(static_cast(u))) : static_cast(0); } template constexpr T msbp1(const T u) { return log2p1(u); } template constexpr T lsbp1(const T u) { return __builtin_ffsll(u); } template constexpr T clog(const T u) { return u ? log2p1(u - 1) : static_cast(u); } template constexpr bool ispow2(const T u) { return u and (static_cast(u) & static_cast(u - 1)) == 0; } template constexpr T ceil2(const T u) { return static_cast(1) << clog(u); } template constexpr T floor2(const T u) { return u == 0 ? static_cast(0) : static_cast(1) << (log2p1(u) - 1); } template constexpr bool btest(const T mask, const usize ind) { return static_cast((static_cast(mask) >> ind) & static_cast(1)); } template void bset(T& mask, const usize ind) { mask |= (static_cast(1) << ind); } template void breset(T& mask, const usize ind) { mask &= ~(static_cast(1) << ind); } template void bflip(T& mask, const usize ind) { mask ^= (static_cast(1) << ind); } template void bset(T& mask, const usize ind, const bool b) { (b ? bset(mask, ind) : breset(mask, ind)); } template constexpr T bcut(const T mask, const usize ind) { return ind == 0 ? static_cast(0) : static_cast((static_cast(mask) << (64 - ind)) >> (64 - ind)); } template bool chmin(T& a, const T& b) { return (a > b ? a = b, true : false); } template bool chmax(T& a, const T& b) { return (a < b ? a = b, true : false); } constexpr unsigned int mod = 1000000007; template constexpr T inf_v = std::numeric_limits::max() / 4; template constexpr Real pi_v = Real{3.141592653589793238462643383279502884}; template T in() { T v; return std::cin >> v, v; } template T in_v(typename std::enable_if<(i == n), c_arr>::type) { return in(); } template auto in_v(typename std::enable_if<(i < n), c_arr>::type& szs) { const usize s = (usize)szs[i]; std::vector(szs))> ans(s); for (usize j = 0; j < s; j++) { ans[j] = in_v(szs); } return ans; } template auto in_v(c_arr szs) { return in_v(szs); } template auto in_t() { return std::tuple...>{in()...}; } struct io_init { io_init() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(20); } } hogechan; template void out(const T& v) { std::cout << v << '\n'; } // Reactiveではstd::flushを忘れない template void out(const T& v, const Args... args) { std::cout << v << ' ', out(args...); } # define SHOW(...) static_cast(0) constexpr ull TEN(const usize n) { return n == 0 ? 1ULL : TEN(n - 1) * 10ULL; } template auto make_v(typename std::enable_if<(i == n), c_arr>::type, const T& v = T{}) { return v; } template auto make_v(typename std::enable_if<(i < n), c_arr>::type szs, const T& v = T{}) { const usize s = (usize)szs[i]; return std::vector(szs, v))>(s, make_v(szs, v)); } template auto make_v(c_arr szs, const T& t = T{}) { return make_v(szs, t); } int main() { const auto [N, X] = in_t(); auto A = in_v({N}); std::sort(A.begin(), A.end()); { int Y = X - 1; for (const int e : A) { Y /= (e + 1); } if (Y == 0) { out(std::string(X, '0')); return 0; } } if (N == 1) { std::string ans(X, '0'); ans[A[0] - 1] = '1'; std::cout << ans << std::endl; return 0; } const int g = std::accumulate(A.begin(), A.end(), 0, [](int a, int b) { return std::gcd(a, b); }); if (A[0] == g) { int Y = 1; for (const int e : A) { Y *= (e + 1); } Y--; for (int x = 1; x <= X; x++) { std::cout << (x >= Y and (x - Y) % g == 0); } std::cout << std::endl; return 0; } const int M = 1 << N; std::vector max(M); for (int m = 0; m < M; m++) { max[m] = X / (1 << (N - popcount(m))) + 1; } std::vector> bit(M); for (int m = 1; m < M; m++) { for (int i = 0; i < N; i++) { if (btest(m, i)) { bit[m].push_back(i); } } } std::vector> dp(M); for (int m = 0; m < M; m++) { dp[m].resize(max[m] + 1); } for (int i = 0; i < N; i++) { if (A[i] <= max[1 << i]) { dp[1 << i][A[i]] = true; } } for (int m = 0; m < M; m++) { if (bit[m].size() <= 1) { continue; } std::vector nxt(dp[m].size(), false); for (const int i : bit[m]) { const int a = A[i]; const int pm = m - (1 << i); for (int px = 0; px < dp[pm].size(); px++) { if (not dp[pm][px]) { continue; } ll nx = (ll)a * (px + 1) + px; if (nx >= nxt.size()) { break; } nxt[nx] = true; } for (int x = a; x < nxt.size(); x++) { nxt[x] = nxt[x] | nxt[x - a]; } for (int x = 0; x < nxt.size(); x++) { dp[m][x] = dp[m][x] | nxt[x]; } std::fill(nxt.begin(), nxt.end(), false); } } for (int x = 1; x <= X; x++) { std::cout << dp[M - 1][x]; } std::cout << std::endl; return 0; }