#include using namespace std; using P = pair; const int M = 1000000007; int x; vector ans; void output() { for (bool i : ans) { cout << i; } cout << '\n'; } int gcd(int a, int b) { while (b > 0) { int t = a % b; a = b; b = t; } return a; } void dfs(const vector& v, int j, int s) { ans[s] = true; if (j == v.size()) return; for (int i = 0; s + i < x; i += v[j]) { if (i > 0 && j + 1 < v.size() && i % v[j + 1] == 0) break; dfs(v, j + 1, s + i); } } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n >> x; vector a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } sort(a.begin(), a.end()); long long sum = 1; for (int i = 0; i < n; ++i) { sum *= a[i] + 1; if (sum > M) break; } ans = vector(x); if (sum - 1 > x) { output(); return 0; } int bs = sum - 1; if (n == 1) { ans[a[0] - 1] = true; output(); return 0; } vector b; for (int i = 0; i < n; ++i) { if (i == 0 || a[i - 1] < a[i]) { b.push_back(a[i]); } } int sz = b.size() < a.size() ? b.size() : b.size() - 1; vector g(1 << b.size()); for (int i = 1; i < (1 << b.size()); ++i) { vector c; bool f = true; for (int j = 0; j < b.size(); ++j) { if (i >> j & 1) { if (g[i] == 0) g[i] = gcd(g[i ^ (1 << j)], b[j]); if (g[i] == g[i ^ 1 << j]) f = false; c.push_back(b[j]); } } if (f && c.size() <= sz) { do { vector v(c.size()); int ss = 1; for (int i = 0; i < c.size(); ++i) { v[i] = ss * c[i]; ss *= c[i] + 1; } dfs(v, 0, bs - 1); } while (next_permutation(c.begin(), c.end())); } } output(); return 0; }