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

klist = []
slist = [list() for _ in range(m)]

for i in range(m):
    k,*s = map(int,input().split())
    klist.append(k)
    slist[i] = s

p = list(map(int,input().split()))

ans = 0
for i in range(2**n):
    for j in range(m):
        cnt = 0
        for l in slist[j]:
            if (i >> (l-1))&1 ==1:
                cnt += 1
        if cnt%2 != p[j]:
            break
    else:
        ans += 1

print(ans) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m klist = [] klist [] list() for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) list() list slist = [list() for _ in range(m)] slist [list() for _ in range(m)] for i in range(m):
    k,*s = map(int,input().split())
    klist.append(k)
    slist[i] = s i range(m) range m k,*s = map(int,input().split()) k map(int,input().split()) map int input().split() ().split () input split *s s klist.append(k) klist.append klist append k slist[i] = s slist[i] slist i s 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):
    for j in range(m):
        cnt = 0
        for l in slist[j]:
            if (i >> (l-1))&1 ==1:
                cnt += 1
        if cnt%2 != p[j]:
            break
    else:
        ans += 1 i range(2**n) range 2**n 2 n for j in range(m):
        cnt = 0
        for l in slist[j]:
            if (i >> (l-1))&1 ==1:
                cnt += 1
        if cnt%2 != p[j]:
            break
    else:
        ans += 1 j range(m) range m cnt = 0 cnt 0 for l in slist[j]:
            if (i >> (l-1))&1 ==1:
                cnt += 1
         l slist[j] slist j if (i >> (l-1))&1 ==1:
                cnt += 1
         (i >> (l-1))&1 ==1 (i >> (l-1))&1 i >> (l-1) i l-1 l 1 1 1 cnt += 1 cnt 1 if cnt%2 != p[j]:
            break
     cnt%2 != p[j] cnt%2 cnt 2 p[j] p j break ans += 1 ans 1 print(ans) print ans n,m = map(int,input().split()) map(int,input().split()) n slist = [list() for _ in range(m)] [list() for _ in range(m)] slist k,*s = map(int,input().split()) map(int,input().split()) k m = map(int,input().split()) map(int,input().split()) m ans = 0 0 ans ans += 1 1 ans cnt = 0 0 cnt klist = [] [] klist p = list(map(int,input().split())) list(map(int,input().split())) p cnt += 1 1 cnt
n,m = map(int,input().split())

klist = []
slist = [list() for _ in range(m)]

for i in range(m):
    k,*s = map(int,input().split())
    klist.append(k)
    slist[i] = s

p = list(map(int,input().split()))

ans = 0
for i in range(2**n):
    for j in range(m):
        cnt = 0
        for l in slist[j]:
            if (i >> (l-1))&1 ==1:
                cnt += 1
        if cnt%2 != p[j]:
            break
    else:
        ans += 1

print(ans)
