N = int(raw_input()) d = int(raw_input()) S = raw_input() ans = [0] * (d + 1) dx = 0 tmp = 1 cnt = 0 exp = False for c in S: if c == "{": dx += 1 elif c == "x": exp = True cnt += 1 elif c in "123456789": exp = True tmp = int(c) elif c != "*": if exp: for i in xrange(dx): tmp *= cnt - i if cnt - dx >= 0: ans[cnt - dx] += tmp exp = False cnt = 0 tmp = 1 if c == "}": dx -= 1 if exp: for i in xrange(dx): tmp *= cnt - i ans[cnt - dx] += tmp print " ".join(map(str, ans))