N, M = map(int,input().split())
K = []
S = []
for i in range(M):
    k = 0
    s = []
    k, *s = map(int,input().split())
    K.append(k)
    S.append(s)
P = list(map(int,input().split()))
res = 0
for bit in range(1 << N):
    judge = True
    for i in range(M):
        cnt = 0
        for s in S[i]:
            cnt += (bit >> s-1) & 1
        if cnt % 2 != P[i]:
            judge = False
            break
    if judge:
        res += 1
print(res) N, M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M K = [] K [] S = [] S [] for i in range(M):
    k = 0
    s = []
    k, *s = map(int,input().split())
    K.append(k)
    S.append(s) i range(M) range M k = 0 k 0 s = [] s [] k, *s = map(int,input().split()) k map(int,input().split()) map int input().split() ().split () input split *s s K.append(k) K.append K append k S.append(s) S.append S append s P = list(map(int,input().split())) P list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split res = 0 res 0 for bit in range(1 << N):
    judge = True
    for i in range(M):
        cnt = 0
        for s in S[i]:
            cnt += (bit >> s-1) & 1
        if cnt % 2 != P[i]:
            judge = False
            break
    if judge:
        res += 1 bit range(1 << N) range 1 << N 1 N judge = True judge True for i in range(M):
        cnt = 0
        for s in S[i]:
            cnt += (bit >> s-1) & 1
        if cnt % 2 != P[i]:
            judge = False
            break
     i range(M) range M cnt = 0 cnt 0 for s in S[i]:
            cnt += (bit >> s-1) & 1
         s S[i] S i cnt += (bit >> s-1) & 1 cnt (bit >> s-1) & 1 bit >> s-1 bit s-1 s 1 1 if cnt % 2 != P[i]:
            judge = False
            break
     cnt % 2 != P[i] cnt % 2 cnt 2 P[i] P i judge = False judge False break if judge:
        res += 1 judge res += 1 res 1 print(res) print res M = map(int,input().split()) map(int,input().split()) M N, M = map(int,input().split()) map(int,input().split()) N res = 0 0 res s = [] [] s cnt += (bit >> s-1) & 1 (bit >> s-1) & 1 cnt judge = False False judge res += 1 1 res k, *s = map(int,input().split()) map(int,input().split()) k judge = True True judge k = 0 0 k cnt = 0 0 cnt K = [] [] K S = [] [] S P = list(map(int,input().split())) list(map(int,input().split())) P
N, M = map(int,input().split())
K = []
S = []
for i in range(M):
    k = 0
    s = []
    k, *s = map(int,input().split())
    K.append(k)
    S.append(s)
P = list(map(int,input().split()))
res = 0
for bit in range(1 << N):
    judge = True
    for i in range(M):
        cnt = 0
        for s in S[i]:
            cnt += (bit >> s-1) & 1
        if cnt % 2 != P[i]:
            judge = False
            break
    if judge:
        res += 1
print(res)