import java.util.Scanner; public class Main_yukicoder265 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt() + 1; int d = sc.nextInt(); char[] s = (sc.next() + "+").toCharArray(); int[] a = new int[d + 1]; int cc = 0; int dd = 0; int xx = 0; for (int i = 0; i < n; i++) { char e = s[i]; if (e >= '1' && e <= '9') { cc = e - '0'; } else if (e == 'x') { xx++; if (cc == 0) { cc = 1; } } else if (cc != 0 && (e == '+' || e == '}')) { for (int j = 0; j < dd; j++) { cc *= xx; xx--; } if (xx >= 0) { a[xx] += cc; } cc = 0; xx = 0; if (e == '}') { dd--; } } else if (e == '}') { dd--; } else if (e == 'd') { dd++; } else if (e == '*') { } else if (e == '{') { } } for (int i = 0; i < d + 1; i++) { if (i > 0) { System.out.print(" "); } System.out.print(a[i]); } System.out.println(""); sc.close(); } }