import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def SI(): return sys.stdin.readline()[:-1] def MI(): return map(int, sys.stdin.readline().split()) def MI1(): return map(int1, sys.stdin.readline().split()) def MF(): return map(float, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LF(): return list(map(float, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] dij = [(0, 1), (1, 0), (0, -1), (-1, 0)] def main(): def cal(s): res = [0] * (d + 1) i = j = 0 inpar = 0 # いくつのd{}に囲まれているか while j < len(s): while s[j] != "+" or inpar > 0: j += 1 if j == len(s): break if s[j] == "{": inpar += 1 if s[j] == "}": inpar -= 1 # 単項式だった場合 if i == 0 and j == len(s): # 微分のとき if s[0] == "d": ret = cal(s[2:-1]) for i, a in enumerate(ret[1:], 1): res[i - 1] = a * i # 累乗の計算のとき else: a = 1 x = 0 for c in s: if c.isdigit(): a = int(c) if c == "x": x += 1 res[x] = a return res # 項ごとに再計算して次数ごとに係数を合計する ret = cal(s[i:j]) for k in range(d + 1): res[k] += ret[k] i = j = j + 1 return res n = II() d = II() s = SI() print(*cal(s)) main()