#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int n, total; cin >> n >> total; vector a(n); for(int i=0; i> a[i]; vector > dp(n, vector(total+1, 0)); dp[n-1][total] = -1; for(int i=n-2; i>=0; --i){ for(int j=0; j<=total; ++j){ int x = j + a[i+1]; int y = j * a[i+1]; if(x <= total && dp[i+1][x] != 0) dp[i][j] = 1; else if(y <= total && dp[i+1][y] != 0) dp[i][j] = 2; } } string ret; int x = a[0]; for(int i=0; i