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

answer = 0
switch = []
for i in range(2 ** n):
    _switch = [0] * n
    for j in range(n):

        if i >> j & 1 :
            _switch[j]  = 1
    switch.append(_switch)

for i in range(2 ** n):
    flag = True
    for j in range(m):
        light = 0
        for _k  in k[j][1:]:
            light += switch[i][_k - 1]

        if light % 2 != p[j]:
            flag = False

    if flag:
        answer += 1

print(answer) 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 answer = 0 answer 0 switch = [] switch [] for i in range(2 ** n):
    _switch = [0] * n
    for j in range(n):

        if i >> j & 1 :
            _switch[j]  = 1
    switch.append(_switch) i range(2 ** n) range 2 ** n 2 n _switch = [0] * n _switch [0] * n [0] 0 n for j in range(n):

        if i >> j & 1 :
            _switch[j]  = 1
     j range(n) range n if i >> j & 1 :
            _switch[j]  = 1
     i >> j & 1 i >> j i j 1 _switch[j]  = 1 _switch[j] _switch j 1 switch.append(_switch) switch.append switch append _switch for i in range(2 ** n):
    flag = True
    for j in range(m):
        light = 0
        for _k  in k[j][1:]:
            light += switch[i][_k - 1]

        if light % 2 != p[j]:
            flag = False

    if flag:
        answer += 1 i range(2 ** n) range 2 ** n 2 n flag = True flag True for j in range(m):
        light = 0
        for _k  in k[j][1:]:
            light += switch[i][_k - 1]

        if light % 2 != p[j]:
            flag = False

     j range(m) range m light = 0 light 0 for _k  in k[j][1:]:
            light += switch[i][_k - 1]

         _k k[j][1:] [j] k j 1: 1 light += switch[i][_k - 1] light switch[i][_k - 1] [i] switch i _k - 1 _k 1 if light % 2 != p[j]:
            flag = False

     light % 2 != p[j] light % 2 light 2 p[j] p j flag = False flag False if flag:
        answer += 1 flag answer += 1 answer 1 print(answer) print answer m=map(int,input().split()) map(int,input().split()) m switch = [] [] switch _switch = [0] * n [0] * n _switch n,m=map(int,input().split()) map(int,input().split()) n p=list(map(int,input().split())) list(map(int,input().split())) p answer = 0 0 answer answer += 1 1 answer flag = True True flag light = 0 0 light flag = False False flag light += switch[i][_k - 1] switch[i][_k - 1] light k=[list(map(int,input().split())) for _ in range(m)] [list(map(int,input().split())) for _ in range(m)] k
n,m=map(int,input().split())
k=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))

answer = 0
switch = []
for i in range(2 ** n):
    _switch = [0] * n
    for j in range(n):

        if i >> j & 1 :
            _switch[j]  = 1
    switch.append(_switch)

for i in range(2 ** n):
    flag = True
    for j in range(m):
        light = 0
        for _k  in k[j][1:]:
            light += switch[i][_k - 1]

        if light % 2 != p[j]:
            flag = False

    if flag:
        answer += 1

print(answer)