N,M = map(int, input().split())
s = [list(map(int, input().split()))[1:] for _ in range(M)]
p = list(map(int, input().split()))
count = 0
for i in range(1<<N):
    for m in range(M):
        switch=0
        for j in range(N):
            if (i>>j)&1 and j+1 in s[m]:
                switch += 1
        if switch%2!= p[m]:
            break
    else:
        count += 1
print(count) N,M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M list(map(int, input().split()))[1:] for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) list(map(int, input().split()))[1:] (map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 1: 1 s = [list(map(int, input().split()))[1:] for _ in range(M)] s [list(map(int, input().split()))[1:] 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 count = 0 count 0 for i in range(1<<N):
    for m in range(M):
        switch=0
        for j in range(N):
            if (i>>j)&1 and j+1 in s[m]:
                switch += 1
        if switch%2!= p[m]:
            break
    else:
        count += 1 i range(1<<N) range 1<<N 1 N for m in range(M):
        switch=0
        for j in range(N):
            if (i>>j)&1 and j+1 in s[m]:
                switch += 1
        if switch%2!= p[m]:
            break
    else:
        count += 1 m range(M) range M switch=0 switch 0 for j in range(N):
            if (i>>j)&1 and j+1 in s[m]:
                switch += 1
         j range(N) range N if (i>>j)&1 and j+1 in s[m]:
                switch += 1
         (i>>j)&1 and j+1 in s[m] (i>>j)&1 i>>j i j 1 j+1 in s[m] j+1 j 1 s[m] s m switch += 1 switch 1 if switch%2!= p[m]:
            break
     switch%2!= p[m] switch%2 switch 2 p[m] p m break count += 1 count 1 print(count) print count s = [list(map(int, input().split()))[1:] for _ in range(M)] [list(map(int, input().split()))[1:] for _ in range(M)] s switch=0 0 switch count += 1 1 count M = map(int, input().split()) map(int, input().split()) M count = 0 0 count N,M = map(int, input().split()) map(int, input().split()) N p = list(map(int, input().split())) list(map(int, input().split())) p switch += 1 1 switch
N,M = map(int, input().split())
s = [list(map(int, input().split()))[1:] for _ in range(M)]
p = list(map(int, input().split()))
count = 0
for i in range(1<<N):
    for m in range(M):
        switch=0
        for j in range(N):
            if (i>>j)&1 and j+1 in s[m]:
                switch += 1
        if switch%2!= p[m]:
            break
    else:
        count += 1
print(count)