l = lambda: list(map(int, input().split()))
N,M = l()
K = [l() for _ in range(M)]
P = l()

ans = 0
fmt = "{:0" + str(N) + "b}"
for i in range(2**N):
    valid = True
    d = list(map(int, list(fmt.format(i))))
    for j in range(M):
        if not P[j] == sum([d[k - 1] for k in K[j][1:]]) % 2:
            valid = False
            break
    if valid:
        ans += 1

print(ans) l = lambda: list(map(int, input().split())) l lambda: list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split N,M = l() N l() l M l() for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) l() l K = [l() for _ in range(M)] K [l() for _ in range(M)] P = l() P l() l ans = 0 ans 0 fmt = "{:0" + str(N) + "b}" fmt "{:0" + str(N) + "b}" "{:0" + str(N) "{:0" str(N) str N "b}" for i in range(2**N):
    valid = True
    d = list(map(int, list(fmt.format(i))))
    for j in range(M):
        if not P[j] == sum([d[k - 1] for k in K[j][1:]]) % 2:
            valid = False
            break
    if valid:
        ans += 1 i range(2**N) range 2**N 2 N valid = True valid True d = list(map(int, list(fmt.format(i)))) d list(map(int, list(fmt.format(i)))) list map(int, list(fmt.format(i))) map int list(fmt.format(i)) list fmt.format(i) fmt.format fmt format i for j in range(M):
        if not P[j] == sum([d[k - 1] for k in K[j][1:]]) % 2:
            valid = False
            break
     j range(M) range M if not P[j] == sum([d[k - 1] for k in K[j][1:]]) % 2:
            valid = False
            break
     not P[j] == sum([d[k - 1] for k in K[j][1:]]) % 2 P[j] == sum([d[k - 1] for k in K[j][1:]]) % 2 P[j] P j sum([d[k - 1] for k in K[j][1:]]) % 2 sum([d[k - 1] for k in K[j][1:]]) sum [d[k - 1] for k in K[j][1:]] 2 valid = False valid False break if valid:
        ans += 1 valid ans += 1 ans 1 print(ans) print ans d = list(map(int, list(fmt.format(i)))) list(map(int, list(fmt.format(i)))) d ans += 1 1 ans K = [l() for _ in range(M)] [l() for _ in range(M)] K ans = 0 0 ans N,M = l() l() N P = l() l() P l = lambda: list(map(int, input().split())) lambda: list(map(int, input().split())) l fmt = "{:0" + str(N) + "b}" "{:0" + str(N) + "b}" fmt valid = False False valid M = l() l() M valid = True True valid
l = lambda: list(map(int, input().split()))
N,M = l()
K = [l() for _ in range(M)]
P = l()

ans = 0
fmt = "{:0" + str(N) + "b}"
for i in range(2**N):
    valid = True
    d = list(map(int, list(fmt.format(i))))
    for j in range(M):
        if not P[j] == sum([d[k - 1] for k in K[j][1:]]) % 2:
            valid = False
            break
    if valid:
        ans += 1

print(ans)