n,m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
p = list(map(int,input().split()))
ans = 0
for i in range(2 ** n):
    t = ['off'] * n
    x = i
    j = 0
    while x > 0:
        if x % 2 != 0:
            t[j] = 'on'
        x = x // 2
        j += 1
    flg = True
    for j in range(m):
        z = 0
        for k in range(1,s[j][0]+1):
            if t[s[j][k]-1] == 'on':
                z += 1
        if z % 2 != p[j]:
            flg = False
            break
    if flg:
        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 i in range(m) for i in range(m) i range(m) range m for i 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 i in range(m)] s [list(map(int,input().split())) for i 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):
    t = ['off'] * n
    x = i
    j = 0
    while x > 0:
        if x % 2 != 0:
            t[j] = 'on'
        x = x // 2
        j += 1
    flg = True
    for j in range(m):
        z = 0
        for k in range(1,s[j][0]+1):
            if t[s[j][k]-1] == 'on':
                z += 1
        if z % 2 != p[j]:
            flg = False
            break
    if flg:
        ans += 1 i range(2 ** n) range 2 ** n 2 n t = ['off'] * n t ['off'] * n ['off'] 'off' n x = i x i j = 0 j 0 while x > 0:
        if x % 2 != 0:
            t[j] = 'on'
        x = x // 2
        j += 1
     x > 0 x 0 if x % 2 != 0:
            t[j] = 'on'
         x % 2 != 0 x % 2 x 2 0 t[j] = 'on' t[j] t j 'on' x = x // 2 x x // 2 x 2 j += 1 j 1 flg = True flg True for j in range(m):
        z = 0
        for k in range(1,s[j][0]+1):
            if t[s[j][k]-1] == 'on':
                z += 1
        if z % 2 != p[j]:
            flg = False
            break
     j range(m) range m z = 0 z 0 for k in range(1,s[j][0]+1):
            if t[s[j][k]-1] == 'on':
                z += 1
         k range(1,s[j][0]+1) range 1 s[j][0]+1 s[j][0] [j] s j 0 1 if t[s[j][k]-1] == 'on':
                z += 1
         t[s[j][k]-1] == 'on' t[s[j][k]-1] t s[j][k]-1 s[j][k] [j] s j k 1 'on' z += 1 z 1 if z % 2 != p[j]:
            flg = False
            break
     z % 2 != p[j] z % 2 z 2 p[j] p j flg = False flg False break if flg:
        ans += 1 flg ans += 1 ans 1 print(ans) print ans n,m = map(int,input().split()) map(int,input().split()) n t = ['off'] * n ['off'] * n t s = [list(map(int,input().split())) for i in range(m)] [list(map(int,input().split())) for i in range(m)] s m = map(int,input().split()) map(int,input().split()) m x = x // 2 x // 2 x j += 1 1 j x = i i x flg = True True flg flg = False False flg ans += 1 1 ans j = 0 0 j z = 0 0 z p = list(map(int,input().split())) list(map(int,input().split())) p ans = 0 0 ans z += 1 1 z
n,m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
p = list(map(int,input().split()))
ans = 0
for i in range(2 ** n):
    t = ['off'] * n
    x = i
    j = 0
    while x > 0:
        if x % 2 != 0:
            t[j] = 'on'
        x = x // 2
        j += 1
    flg = True
    for j in range(m):
        z = 0
        for k in range(1,s[j][0]+1):
            if t[s[j][k]-1] == 'on':
                z += 1
        if z % 2 != p[j]:
            flg = False
            break
    if flg:
        ans += 1
print(ans)