n, m = map(int, input().split())
K = [0]*m
S = [[] for _ in range(m)]
for i in range(m):
    K[i], *S[i] = map(lambda x:int(x)-1, input().split())
    K[i] += 1
P = list(map(int, input().split()))

ans = 0
for i in range(pow(2,n)):
    B = bin(i)[2:].zfill(n)
    D = {j:True if b=='1' else False for j,b in enumerate(B)}
    _P = []
    for j,s in enumerate(S):
        _P.append(sum(D[_s] for _s in s)%2 == P[j])
    if all(_P):
        ans += 1
print(ans) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m K = [0]*m K [0]*m [0] 0 m [] for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) [] S = [[] for _ in range(m)] S [[] for _ in range(m)] for i in range(m):
    K[i], *S[i] = map(lambda x:int(x)-1, input().split())
    K[i] += 1 i range(m) range m K[i], *S[i] = map(lambda x:int(x)-1, input().split()) K[i] K i map(lambda x:int(x)-1, input().split()) map lambda x:int(x)-1 int(x)-1 int(x) int x 1 x input().split() ().split () input split *S[i] S[i] S i K[i] += 1 K[i] K i 1 P = list(map(int, input().split())) P list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for i in range(pow(2,n)):
    B = bin(i)[2:].zfill(n)
    D = {j:True if b=='1' else False for j,b in enumerate(B)}
    _P = []
    for j,s in enumerate(S):
        _P.append(sum(D[_s] for _s in s)%2 == P[j])
    if all(_P):
        ans += 1 i range(pow(2,n)) range pow(2,n) pow 2 n B = bin(i)[2:].zfill(n) B bin(i)[2:].zfill(n) [2:].zfill [2:] (i) bin i 2: 2 zfill n j:True if b=='1' else False for j,b in enumerate(B) for j,b in enumerate(B) j b enumerate(B) enumerate B for j,b in enumerate(B) j True if b=='1' else False b=='1' b '1' True False D = {j:True if b=='1' else False for j,b in enumerate(B)} D {j:True if b=='1' else False for j,b in enumerate(B)} _P = [] _P [] for j,s in enumerate(S):
        _P.append(sum(D[_s] for _s in s)%2 == P[j])
     j s enumerate(S) enumerate S _P.append(sum(D[_s] for _s in s)%2 == P[j]) _P.append _P append sum(D[_s] for _s in s)%2 == P[j] sum(D[_s] for _s in s)%2 sum(D[_s] for _s in s) sum D[_s] D _s 2 P[j] P j if all(_P):
        ans += 1 all(_P) all _P ans += 1 ans 1 print(ans) print ans m = map(int, input().split()) map(int, input().split()) m S = [[] for _ in range(m)] [[] for _ in range(m)] S ans += 1 1 ans _P = [] [] _P n, m = map(int, input().split()) map(int, input().split()) n B = bin(i)[2:].zfill(n) bin(i)[2:].zfill(n) B K = [0]*m [0]*m K ans = 0 0 ans D = {j:True if b=='1' else False for j,b in enumerate(B)} {j:True if b=='1' else False for j,b in enumerate(B)} D P = list(map(int, input().split())) list(map(int, input().split())) P
n, m = map(int, input().split())
K = [0]*m
S = [[] for _ in range(m)]
for i in range(m):
    K[i], *S[i] = map(lambda x:int(x)-1, input().split())
    K[i] += 1
P = list(map(int, input().split()))

ans = 0
for i in range(pow(2,n)):
    B = bin(i)[2:].zfill(n)
    D = {j:True if b=='1' else False for j,b in enumerate(B)}
    _P = []
    for j,s in enumerate(S):
        _P.append(sum(D[_s] for _s in s)%2 == P[j])
    if all(_P):
        ans += 1
print(ans)