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

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

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