#include #include #include using namespace std; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) bool dp1[101][100010]; string dp2[101][100010]; int main(){ int N, total, A; cin >> N >> total; REP(i,N+1) REP(j,total+1) dp1[i][j] = false; cin >> A; dp1[0][A] = true; REP(i,N-1){ cin >> A; for(int j = 0; j <= total; j++){ if(!dp1[i][j]) continue; int k = j + A; if(k <= total){ string ks = dp2[i][j] + "0"; dp1[i+1][k] = true; if(dp2[i+1][k] == "" || dp2[i+1][k] > ks) dp2[i+1][k] = ks; } int l = j * A; if(l <= total){ string ls = dp2[i][j] + "1"; dp1[i+1][l] = true; if(dp2[i+1][l] == "" || dp2[i+1][l] > ls) dp2[i+1][l] = ls; } } } string res = dp2[N-1][total]; if(res != ""){ REP(i,res.size()){ if(res[i] == '0') res[i] = '+'; if(res[i] == '1') res[i] = '*'; } cout << res << endl; } return 0; }