n = int(input()) total = int(input()) a = list(map(int, input().split())) stack = [] stack.append((0, a[0], "")) visited = set() found = False while stack: i, current, ops = stack.pop() if i == n - 1: if current == total: print(ops) found = True break continue if (i, current) in visited: continue visited.add((i, current)) next_num = a[i + 1] # We want to try '+' first, so append '*' first then '+' # because stack is LIFO new_mult = current * next_num if new_mult <= total: stack.append((i + 1, new_mult, ops + "*")) new_plus = current + next_num if new_plus <= total: stack.append((i + 1, new_plus, ops + "+")) # According to the problem statement, a solution exists, so no need to handle not found case