n, m = map(int, input().split())
q = list()
for i in range(m):
    q.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans = 0

for s in range(2**n):
    judge = True
    for i in range(m):
        cnt = 0
        for j in range(1, len(q[i])):
            w = q[i][j]
            if s >>(w-1) & 1 == 1:
                cnt += 1
        if cnt % 2 != p[i]:
            judge = False
    if judge:
        ans += 1
print(ans) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m q = list() q list() list for i in range(m):
    q.append(list(map(int, input().split()))) i range(m) range m q.append(list(map(int, input().split()))) q.append q append list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 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 s in range(2**n):
    judge = True
    for i in range(m):
        cnt = 0
        for j in range(1, len(q[i])):
            w = q[i][j]
            if s >>(w-1) & 1 == 1:
                cnt += 1
        if cnt % 2 != p[i]:
            judge = False
    if judge:
        ans += 1 s range(2**n) range 2**n 2 n judge = True judge True for i in range(m):
        cnt = 0
        for j in range(1, len(q[i])):
            w = q[i][j]
            if s >>(w-1) & 1 == 1:
                cnt += 1
        if cnt % 2 != p[i]:
            judge = False
     i range(m) range m cnt = 0 cnt 0 for j in range(1, len(q[i])):
            w = q[i][j]
            if s >>(w-1) & 1 == 1:
                cnt += 1
         j range(1, len(q[i])) range 1 len(q[i]) len q[i] q i w = q[i][j] w q[i][j] [i] q i j if s >>(w-1) & 1 == 1:
                cnt += 1
         s >>(w-1) & 1 == 1 s >>(w-1) & 1 s >>(w-1) s w-1 w 1 1 1 cnt += 1 cnt 1 if cnt % 2 != p[i]:
            judge = False
     cnt % 2 != p[i] cnt % 2 cnt 2 p[i] p i judge = False judge False if judge:
        ans += 1 judge ans += 1 ans 1 print(ans) print ans q = list() list() q w = q[i][j] q[i][j] w n, m = map(int, input().split()) map(int, input().split()) n p = list(map(int, input().split())) list(map(int, input().split())) p cnt += 1 1 cnt judge = False False judge m = map(int, input().split()) map(int, input().split()) m judge = True True judge ans = 0 0 ans cnt = 0 0 cnt ans += 1 1 ans
n, m = map(int, input().split())
q = list()
for i in range(m):
    q.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans = 0

for s in range(2**n):
    judge = True
    for i in range(m):
        cnt = 0
        for j in range(1, len(q[i])):
            w = q[i][j]
            if s >>(w-1) & 1 == 1:
                cnt += 1
        if cnt % 2 != p[i]:
            judge = False
    if judge:
        ans += 1
print(ans)