N, M = map(int, input().split()) # Nはスイッチの数、Mは電球の数
lights = [[0] * N for _ in range(M)]
for i in range(M): 
    temp = list(map(int, input().split())) # 0番目はスイッチの個数、1番目以降はスイッチを示す
    k = temp[0]
    switches = temp[1:]
    for j in range(k):
        lights[i][switches[j]-1] = 1
P = list(map(int, input().split())) # 個数を2で割ったあまりが要素と等しい場合に点灯する

answer_count = 0
for i in range(2**N):
    flag = True
    for k in range(M):
        count = 0
        for j in range(N):
            if (i >> j) & 1:
                count += lights[k][j]
        if count % 2 != P[k]:
            flag = False
            break
    if flag:
        answer_count += 1

print(answer_count) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M [0] * N for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) [0] * N [0] 0 N lights = [[0] * N for _ in range(M)] lights [[0] * N for _ in range(M)] for i in range(M): 
    temp = list(map(int, input().split())) # 0番目はスイッチの個数、1番目以降はスイッチを示す
    k = temp[0]
    switches = temp[1:]
    for j in range(k):
        lights[i][switches[j]-1] = 1 i range(M) range M temp = list(map(int, input().split())) temp list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k = temp[0] k temp[0] temp 0 switches = temp[1:] switches temp[1:] temp 1: 1 for j in range(k):
        lights[i][switches[j]-1] = 1 j range(k) range k lights[i][switches[j]-1] = 1 lights[i][switches[j]-1] [i] lights i switches[j]-1 switches[j] switches j 1 1 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_count = 0 answer_count 0 for i in range(2**N):
    flag = True
    for k in range(M):
        count = 0
        for j in range(N):
            if (i >> j) & 1:
                count += lights[k][j]
        if count % 2 != P[k]:
            flag = False
            break
    if flag:
        answer_count += 1 i range(2**N) range 2**N 2 N flag = True flag True for k in range(M):
        count = 0
        for j in range(N):
            if (i >> j) & 1:
                count += lights[k][j]
        if count % 2 != P[k]:
            flag = False
            break
     k range(M) range M count = 0 count 0 for j in range(N):
            if (i >> j) & 1:
                count += lights[k][j]
         j range(N) range N if (i >> j) & 1:
                count += lights[k][j]
         (i >> j) & 1 i >> j i j 1 count += lights[k][j] count lights[k][j] [k] lights k j if count % 2 != P[k]:
            flag = False
            break
     count % 2 != P[k] count % 2 count 2 P[k] P k flag = False flag False break if flag:
        answer_count += 1 flag answer_count += 1 answer_count 1 print(answer_count) print answer_count P = list(map(int, input().split())) list(map(int, input().split())) P N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M lights = [[0] * N for _ in range(M)] [[0] * N for _ in range(M)] lights answer_count = 0 0 answer_count answer_count += 1 1 answer_count temp = list(map(int, input().split())) list(map(int, input().split())) temp count = 0 0 count k = temp[0] temp[0] k flag = False False flag flag = True True flag switches = temp[1:] temp[1:] switches count += lights[k][j] lights[k][j] count
N, M = map(int, input().split()) # Nはスイッチの数、Mは電球の数
lights = [[0] * N for _ in range(M)]
for i in range(M): 
    temp = list(map(int, input().split())) # 0番目はスイッチの個数、1番目以降はスイッチを示す
    k = temp[0]
    switches = temp[1:]
    for j in range(k):
        lights[i][switches[j]-1] = 1
P = list(map(int, input().split())) # 個数を2で割ったあまりが要素と等しい場合に点灯する

answer_count = 0
for i in range(2**N):
    flag = True
    for k in range(M):
        count = 0
        for j in range(N):
            if (i >> j) & 1:
                count += lights[k][j]
        if count % 2 != P[k]:
            flag = False
            break
    if flag:
        answer_count += 1

print(answer_count)