import sys def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() d = I() S = S() def der(n,m): # x^nのm階微分 if n < m: return 0,0 res = 1 for i in range(m): res *= n-i return n-m,res ANS = [0]*(d+1) count = 0 # 何階微分か idx = 0 while idx < N: s = S[idx] if s == 'd': count += 1 idx += 2 elif s == '}': count -= 1 idx += 1 elif s == '+': idx += 1 else: coefficient = 1 power = 0 for j in range(idx,N): s = S[j] if s.isdigit(): coefficient = int(s) elif s == 'x': power += 1 elif s == '*': continue elif s == '+': idx = j+1 break else: idx = j break else: idx = N e,c = der(power,count) ANS[e] += coefficient*c print(*ANS)