package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func Scanner() string { sc.Scan() return sc.Text() } func main() { buf := make([]byte, 0) sc.Buffer(buf, 100000007) sc.Split(bufio.ScanWords) n, _ := strconv.Atoi(Scanner()) t, _ := strconv.Atoi(Scanner()) a := make([]int, n) for i := 0; i < n; i++ { a[i], _ = strconv.Atoi(Scanner()) } dp := make([]map[int]string, n) for i := 0; i < n; i++ { dp[i] = make(map[int]string) } dp[0][a[0]] = "" for i := 1; i < n; i++ { for j := range dp[i-1] { if j*a[i] <= t { dp[i][j*a[i]] = max(dp[i][j*a[i]], dp[i-1][j]) } if j+a[i] <= t { dp[i][j+a[i]] = max2(dp[i][j+a[i]], dp[i-1][j]) } } } fmt.Println(dp[n-1][t]) } func max(x string, y string) string { if x > y { return x } else { return y + "*" } } func max2(x string, y string) string { if x > y { return x } else { return y + "+" } }