#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) D = int(readline()) S = read().rstrip().decode() import numpy as np def der(f): g = np.zeros_like(f) g[:-1] = f[1:] * np.arange(1, len(f)) return g S = S.replace('d{', ' d{ ').replace('}', ' } ').replace('+', ' + ').split() depth = 0 answer = np.zeros(D + 1, np.int64) for word in S: if word == '+': continue if word == 'd{': depth += 1 continue if word == '}': depth -= 1 continue if depth > D: continue coef = 1 deg = 0 terms = word.split('*') for t in terms: if t == 'x': deg += 1 else: coef = int(t) f = np.zeros(D + 1, np.int64) f[deg] = coef for _ in range(depth): f = der(f) answer += f print(*answer)