n, m = map(int, input().split())
ks = [[int(i) for i in input().split()][1:] for _ in range(m)]
p = list(map(int, input().split()))

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

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