#include #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using namespace std; template ostream& operator<<(ostream& o,const pair &p){ return o<<"("< ostream& operator<<(ostream& o,const vector &vc){ o<<"{"; for(const T& v:vc) o< using V = vector; template using VV = vector>; constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); } #ifdef LOCAL #define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl #else #define show(x) true #endif int main(){ cin.tie(0); ios::sync_with_stdio(false); //DON'T USE scanf/printf/puts !! cout << fixed << setprecision(20); int N,X; cin >> N >> X; ll MN = 1; V a(N); rep(i,N) cin >> a[i]; const ll inf = 1e10; V res(X+1); auto ANSWER = [&](){ string s(X,'0'); rep(i,X) if(res[i+1]) s[i] = '1'; cout << s << endl; exit(0); }; { ll A = 1; rep(i,N){ A *= a[i] + 1; chmin(A,inf); } A--; if(A > X){ ANSWER(); } MN = A; } sort(all(a)); if(a[0] == 1){ for(int i=MN;i<=X;i++) res[i] = true; ANSWER(); } set> done; function)> dfs = [&](V a){ ll A = 1; rep(i,N){ A *= a[i]+1; if(A >= inf) return true; } A--; if(A > X){ return true; //OVER } if((int)a.size() == 1){ res[a[0]] = true; return false; } if(done.count(a)) return false; done.insert(a); int N = a.size(); rep(i,N) rep(j,N) if(i!=j){ rep1(s,1000000){ V na; rep(k,N) if(k!=i && k!=j) na.pb(a[k]); na.pb(a[i]*a[j]+s*a[i]+a[j]); sort(all(na)); if(dfs(na)){ break; } } } return false; }; dfs(a); string s(X,'0'); rep1(i,X) if(res[i]) s[i-1] = '1'; cout << s << endl; }