text: # Problem There are n lamps on a line, numbered from 1 to n.Each one has an initial state off (0) or on (1).You're given k subsets A_1, …, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty.In other words, for all 1 ≤ i_1 < i_2 < i_3 ≤ k, A_{i_1} ∩ A_{i_2} ∩ A_{i_3} = ∅.In one operation, you can choose one of these k subsets and switch the state of all lamps in it.It is guaranteed that, with the given subsets, it's possible to make all lamps be simultaneously on using this type of operation.Let m_i be the minimum number of operations you have to do in order to make the i first lamps be simultaneously on.Note that there is no condition upon the state of other lamps (between i+1 and n), they can be either off or on.You have to compute m_i for all 1 ≤ i ≤ n.Input The first line contains two integers n and k (1 ≤ n, k ≤ 3 ⋅ 10^5).The second line contains a binary string of length n, representing the initial state of each lamp (the lamp i is off if s_i = 0, on if s_i = 1).The description of each one of the k subsets follows, in the following format: The first line of the description contains a single integer c (1 ≤ c ≤ n) — the number of elements in the subset.The second line of the description contains c distinct integers x_1, …, x_c (1 ≤ x_i ≤ n) — the elements of the subset.It is guaranteed that: * The intersection of any three subsets is empty; * It's possible to make all lamps be simultaneously on using some operations.Output You must output n lines.The i-th line should contain a single integer m_i — the minimum number of operations required to make the lamps 1 to i be simultaneously on.