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

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

for i in range(2**n):
    status = ['+']*n
    for j in range(n):
        if ((i>>j)&1):
            status[j] = '-'
    num = 0
    for m, k in enumerate(s):
        count = 0
        for l in k:
            if status[l-1] == '+':
                count += 1
        if count%2 != p[m]:
            break
        else:
            num += 1
    if num == m+1:
        ans += 1
print(ans)
