n, m = map(int, input().split())
k = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
 
ans = 0
for i in range(2**n):
    light = 0
    for ki, j in enumerate(k):
        switch = 0
        for s in j[1:]:
            if i & (1 << s-1):
                switch += 1
        if switch % 2 == p[ki]:
            light += 1
    if light == m:
        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 k = [list(map(int, input().split())) for _ in range(m)] k [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):
    light = 0
    for ki, j in enumerate(k):
        switch = 0
        for s in j[1:]:
            if i & (1 << s-1):
                switch += 1
        if switch % 2 == p[ki]:
            light += 1
    if light == m:
        ans += 1 i range(2**n) range 2**n 2 n light = 0 light 0 for ki, j in enumerate(k):
        switch = 0
        for s in j[1:]:
            if i & (1 << s-1):
                switch += 1
        if switch % 2 == p[ki]:
            light += 1
     ki j enumerate(k) enumerate k switch = 0 switch 0 for s in j[1:]:
            if i & (1 << s-1):
                switch += 1
         s j[1:] j 1: 1 if i & (1 << s-1):
                switch += 1
         i & (1 << s-1) i 1 << s-1 1 s-1 s 1 switch += 1 switch 1 if switch % 2 == p[ki]:
            light += 1
     switch % 2 == p[ki] switch % 2 switch 2 p[ki] p ki light += 1 light 1 if light == m:
        ans += 1 light == m light m ans += 1 ans 1 print(ans) print ans n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m p = list(map(int, input().split())) list(map(int, input().split())) p switch = 0 0 switch ans += 1 1 ans ans = 0 0 ans light = 0 0 light k = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] k switch += 1 1 switch light += 1 1 light
n, m = map(int, input().split())
k = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
 
ans = 0
for i in range(2**n):
    light = 0
    for ki, j in enumerate(k):
        switch = 0
        for s in j[1:]:
            if i & (1 << s-1):
                switch += 1
        if switch % 2 == p[ki]:
            light += 1
    if light == m:
        ans += 1
print(ans)