n,m = map(int, input().split())
d = [list(map(int, input().split()))[1:] for _ in range(m)]
s = list(map(int, input().split()))

count = 0

for i in range(2**n):

    for j in range(m):
        switch = 0
        for k in range(n):
            if (i >> k) & 1 and k+1 in d[j]:
                switch += 1
        if switch%2 != s[j]:
            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 d = [list(map(int, input().split()))[1:] for _ in range(m)] d [list(map(int, input().split()))[1:] for _ in range(m)] s = list(map(int, input().split())) s 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(2**n):

    for j in range(m):
        switch = 0
        for k in range(n):
            if (i >> k) & 1 and k+1 in d[j]:
                switch += 1
        if switch%2 != s[j]:
            break
    else:
        count += 1 i range(2**n) range 2**n 2 n for j in range(m):
        switch = 0
        for k in range(n):
            if (i >> k) & 1 and k+1 in d[j]:
                switch += 1
        if switch%2 != s[j]:
            break
    else:
        count += 1 j range(m) range m switch = 0 switch 0 for k in range(n):
            if (i >> k) & 1 and k+1 in d[j]:
                switch += 1
         k range(n) range n if (i >> k) & 1 and k+1 in d[j]:
                switch += 1
         (i >> k) & 1 and k+1 in d[j] (i >> k) & 1 i >> k i k 1 k+1 in d[j] k+1 k 1 d[j] d j switch += 1 switch 1 if switch%2 != s[j]:
            break
     switch%2 != s[j] switch%2 switch 2 s[j] s j break count += 1 count 1 print(count) print count m = map(int, input().split()) map(int, input().split()) m n,m = map(int, input().split()) map(int, input().split()) n count = 0 0 count d = [list(map(int, input().split()))[1:] for _ in range(m)] [list(map(int, input().split()))[1:] for _ in range(m)] d count += 1 1 count s = list(map(int, input().split())) list(map(int, input().split())) s switch += 1 1 switch switch = 0 0 switch
n,m = map(int, input().split())
d = [list(map(int, input().split()))[1:] for _ in range(m)]
s = list(map(int, input().split()))

count = 0

for i in range(2**n):

    for j in range(m):
        switch = 0
        for k in range(n):
            if (i >> k) & 1 and k+1 in d[j]:
                switch += 1
        if switch%2 != s[j]:
            break
    else:
        count += 1

print(count)