#include #include #include #include #include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) #define var auto #define mod 1000000007 #define nil -1 typedef long long ll; using namespace std; inline int input(){ int a; cin >> a; return a; } template inline void output(T a, int p) { if(p){ cout << fixed << setprecision(p) << a << "\n"; } else{ cout << a << "\n"; } } // end of template int main() { cin.tie(0); // source code int N = input(); int T = input(); vector A(N); rep(i, N){ cin >> A[i]; } ll inf = 1ll << 52; vector dp(T + 1, inf), sub(T + 1, inf); dp[0] = 0; rep(i, N){ sub.assign(T + 1, inf); rep(j, T + 1){ if (j + A[i] <= T) { sub[j + A[i]] = min(sub[j + A[i]], dp[j] * 2); } if (j * A[i] <= T) { sub[j * A[i]] = min(sub[j * A[i]], dp[j] * 2 + 1); } } dp = sub; } // output(dp[T], 0); string ret = ""; for (int i = N - 2; i >= 0; i--) { if (dp[T] % 2) ret += '*', dp[T] = (dp[T] - 1) / 2; else ret += '+', dp[T] /= 2; } reverse(ret.begin(), ret.end()); output(ret, 0); return 0; }