# cs: c nnected switches
n, m = map(int, input().split())

# cs: connected switches
cs = [list(map(int, input().split())) for _ in range(m)]
ps = list(map(int, input().split()))

# bit全探索(0: すべてoffは不要)
ans = 0
# on: 0:消えてる、1:点いてる
# 10: 1 2  3   4 
# 0b: 1 10 11, 100..
for on in range(2**n):
    # bin: バイナリ文字列に変換
    # 3 -> '0b11'
    # rust で右0埋め
    patern = bin(on)[2:].rjust(n, '0')
    ok = True

    for i in range(m):
        ct = 0
        for j in range(cs[i][0]):
            if patern[cs[i][j+1] - 1] == '1':
                ct += 1
        if ct%2 != ps[i]:
            ok = False
    if ok:
        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 cs = [list(map(int, input().split())) for _ in range(m)] cs [list(map(int, input().split())) for _ in range(m)] ps = list(map(int, input().split())) ps list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for on in range(2**n):
    # bin: バイナリ文字列に変換
    # 3 -> '0b11'
    # rust で右0埋め
    patern = bin(on)[2:].rjust(n, '0')
    ok = True

    for i in range(m):
        ct = 0
        for j in range(cs[i][0]):
            if patern[cs[i][j+1] - 1] == '1':
                ct += 1
        if ct%2 != ps[i]:
            ok = False
    if ok:
        ans += 1 on range(2**n) range 2**n 2 n patern = bin(on)[2:].rjust(n, '0') patern bin(on)[2:].rjust(n, '0') [2:].rjust [2:] (on) bin on 2: 2 rjust n '0' ok = True ok True for i in range(m):
        ct = 0
        for j in range(cs[i][0]):
            if patern[cs[i][j+1] - 1] == '1':
                ct += 1
        if ct%2 != ps[i]:
            ok = False
     i range(m) range m ct = 0 ct 0 for j in range(cs[i][0]):
            if patern[cs[i][j+1] - 1] == '1':
                ct += 1
         j range(cs[i][0]) range cs[i][0] [i] cs i 0 if patern[cs[i][j+1] - 1] == '1':
                ct += 1
         patern[cs[i][j+1] - 1] == '1' patern[cs[i][j+1] - 1] patern cs[i][j+1] - 1 cs[i][j+1] [i] cs i j+1 j 1 1 '1' ct += 1 ct 1 if ct%2 != ps[i]:
            ok = False
     ct%2 != ps[i] ct%2 ct 2 ps[i] ps i ok = False ok False if ok:
        ans += 1 ok ans += 1 ans 1 print(ans) print ans ok = True True ok n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m ans = 0 0 ans patern = bin(on)[2:].rjust(n, '0') bin(on)[2:].rjust(n, '0') patern ct = 0 0 ct cs = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] cs ps = list(map(int, input().split())) list(map(int, input().split())) ps ok = False False ok ans += 1 1 ans ct += 1 1 ct
# cs: c nnected switches
n, m = map(int, input().split())

# cs: connected switches
cs = [list(map(int, input().split())) for _ in range(m)]
ps = list(map(int, input().split()))

# bit全探索(0: すべてoffは不要)
ans = 0
# on: 0:消えてる、1:点いてる
# 10: 1 2  3   4 
# 0b: 1 10 11, 100..
for on in range(2**n):
    # bin: バイナリ文字列に変換
    # 3 -> '0b11'
    # rust で右0埋め
    patern = bin(on)[2:].rjust(n, '0')
    ok = True

    for i in range(m):
        ct = 0
        for j in range(cs[i][0]):
            if patern[cs[i][j+1] - 1] == '1':
                ct += 1
        if ct%2 != ps[i]:
            ok = False
    if ok:
        ans += 1
print(ans)
