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

    
        


