n, m = map(int, input().split(' '))
K = []
S = []
for i in range(m):
    l = list(map(int, input().split(' ')))
    K.append(l[0])
    S.append(l[1:])
p = list(map(int, input().split(' ')))
ans = 0
for i in range(2**n):
    light = 0
    for j in range(m):
        sw = 0
        for s in S[j]:
            if (i>>(s-1))&1:
                sw += 1
        if sw%2 == p[j]:
            light+=1
    if light == m:
        ans += 1
print(ans) n, m = map(int, input().split(' ')) n map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' m K = [] K [] S = [] S [] for i in range(m):
    l = list(map(int, input().split(' ')))
    K.append(l[0])
    S.append(l[1:]) i range(m) range m l = list(map(int, input().split(' '))) l list(map(int, input().split(' '))) list map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' K.append(l[0]) K.append K append l[0] l 0 S.append(l[1:]) S.append S append l[1:] l 1: 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(2**n):
    light = 0
    for j in range(m):
        sw = 0
        for s in S[j]:
            if (i>>(s-1))&1:
                sw += 1
        if sw%2 == p[j]:
            light+=1
    if light == m:
        ans += 1 i range(2**n) range 2**n 2 n light = 0 light 0 for j in range(m):
        sw = 0
        for s in S[j]:
            if (i>>(s-1))&1:
                sw += 1
        if sw%2 == p[j]:
            light+=1
     j range(m) range m sw = 0 sw 0 for s in S[j]:
            if (i>>(s-1))&1:
                sw += 1
         s S[j] S j if (i>>(s-1))&1:
                sw += 1
         (i>>(s-1))&1 i>>(s-1) i s-1 s 1 1 sw += 1 sw 1 if sw%2 == p[j]:
            light+=1
     sw%2 == p[j] sw%2 sw 2 p[j] p j light+=1 light 1 if light == m:
        ans += 1 light == m light m ans += 1 ans 1 print(ans) print ans p = list(map(int, input().split(' '))) list(map(int, input().split(' '))) p m = map(int, input().split(' ')) map(int, input().split(' ')) m n, m = map(int, input().split(' ')) map(int, input().split(' ')) n sw += 1 1 sw sw = 0 0 sw S = [] [] S light+=1 1 light ans += 1 1 ans l = list(map(int, input().split(' '))) list(map(int, input().split(' '))) l light = 0 0 light K = [] [] K ans = 0 0 ans
n, m = map(int, input().split(' '))
K = []
S = []
for i in range(m):
    l = list(map(int, input().split(' ')))
    K.append(l[0])
    S.append(l[1:])
p = list(map(int, input().split(' ')))
ans = 0
for i in range(2**n):
    light = 0
    for j in range(m):
        sw = 0
        for s in S[j]:
            if (i>>(s-1))&1:
                sw += 1
        if sw%2 == p[j]:
            light+=1
    if light == m:
        ans += 1
print(ans)