n,m = map(int,input().split())

switch = []

for i in range(m):
    switch.append(list(map(lambda x:int(x)-1 ,input().split()))[1:])
p = list(map(int,input().split()))


ans = 0
for i in range(2**n):
    s = []
    for j in range(n):
        s.append((i>>j)&1)
    f = 1
    for j in range(m):
        a = 0
        for k in switch[j]:
            a += s[k]

        if a%2== p[j]:
            pass
        else:
            f = 0
            break

    if f:
        ans += 1

print(ans) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m switch = [] switch [] for i in range(m):
    switch.append(list(map(lambda x:int(x)-1 ,input().split()))[1:]) i range(m) range m switch.append(list(map(lambda x:int(x)-1 ,input().split()))[1:]) switch.append switch append list(map(lambda x:int(x)-1 ,input().split()))[1:] (map(lambda x:int(x)-1 ,input().split())) list 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 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):
    s = []
    for j in range(n):
        s.append((i>>j)&1)
    f = 1
    for j in range(m):
        a = 0
        for k in switch[j]:
            a += s[k]

        if a%2== p[j]:
            pass
        else:
            f = 0
            break

    if f:
        ans += 1 i range(2**n) range 2**n 2 n s = [] s [] for j in range(n):
        s.append((i>>j)&1)
     j range(n) range n s.append((i>>j)&1) s.append s append (i>>j)&1 i>>j i j 1 f = 1 f 1 for j in range(m):
        a = 0
        for k in switch[j]:
            a += s[k]

        if a%2== p[j]:
            pass
        else:
            f = 0
            break

     j range(m) range m a = 0 a 0 for k in switch[j]:
            a += s[k]

         k switch[j] switch j a += s[k] a s[k] s k if a%2== p[j]:
            pass
        else:
            f = 0
            break

     a%2== p[j] a%2 a 2 p[j] p j f = 0 f 0 break if f:
        ans += 1 f ans += 1 ans 1 print(ans) print ans m = map(int,input().split()) map(int,input().split()) m f = 1 1 f a += s[k] s[k] a switch = [] [] switch s = [] [] s a = 0 0 a ans += 1 1 ans p = list(map(int,input().split())) list(map(int,input().split())) p n,m = map(int,input().split()) map(int,input().split()) n f = 0 0 f ans = 0 0 ans
n,m = map(int,input().split())

switch = []

for i in range(m):
    switch.append(list(map(lambda x:int(x)-1 ,input().split()))[1:])
p = list(map(int,input().split()))


ans = 0
for i in range(2**n):
    s = []
    for j in range(n):
        s.append((i>>j)&1)
    f = 1
    for j in range(m):
        a = 0
        for k in switch[j]:
            a += s[k]

        if a%2== p[j]:
            pass
        else:
            f = 0
            break

    if f:
        ans += 1

print(ans)