n, m = map(int, input().split())
ks = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0

for i in range(2**n):
    judge = True
    switch = [('off') for _ in range(n)]
    for j in range(len(switch)):
        if (i >> j) & 1:
            switch[j] = 'on'
    for k in range(m):
        count = 0
        for l in range(ks[k][0]):
            if switch[ks[k][l+1]-1] == 'on':
                count += 1
        if count % 2 != p[k]:
            judge = False
            break
    if judge == True:
        ans += 1

print(ans) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m list(map(int, input().split())) for i in range(m) for i in range(m) i range(m) range m for i in range(m) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ks = [list(map(int, input().split())) for i in range(m)] ks [list(map(int, input().split())) for i 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 ans = 0 ans 0 for i in range(2**n):
    judge = True
    switch = [('off') for _ in range(n)]
    for j in range(len(switch)):
        if (i >> j) & 1:
            switch[j] = 'on'
    for k in range(m):
        count = 0
        for l in range(ks[k][0]):
            if switch[ks[k][l+1]-1] == 'on':
                count += 1
        if count % 2 != p[k]:
            judge = False
            break
    if judge == True:
        ans += 1 i range(2**n) range 2**n 2 n judge = True judge True ('off') for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) 'off' switch = [('off') for _ in range(n)] switch [('off') for _ in range(n)] for j in range(len(switch)):
        if (i >> j) & 1:
            switch[j] = 'on'
     j range(len(switch)) range len(switch) len switch if (i >> j) & 1:
            switch[j] = 'on'
     (i >> j) & 1 i >> j i j 1 switch[j] = 'on' switch[j] switch j 'on' for k in range(m):
        count = 0
        for l in range(ks[k][0]):
            if switch[ks[k][l+1]-1] == 'on':
                count += 1
        if count % 2 != p[k]:
            judge = False
            break
     k range(m) range m count = 0 count 0 for l in range(ks[k][0]):
            if switch[ks[k][l+1]-1] == 'on':
                count += 1
         l range(ks[k][0]) range ks[k][0] [k] ks k 0 if switch[ks[k][l+1]-1] == 'on':
                count += 1
         switch[ks[k][l+1]-1] == 'on' switch[ks[k][l+1]-1] switch ks[k][l+1]-1 ks[k][l+1] [k] ks k l+1 l 1 1 'on' count += 1 count 1 if count % 2 != p[k]:
            judge = False
            break
     count % 2 != p[k] count % 2 count 2 p[k] p k judge = False judge False break if judge == True:
        ans += 1 judge == True judge True ans += 1 ans 1 print(ans) print ans count += 1 1 count judge = False False judge p = list(map(int, input().split())) list(map(int, input().split())) p judge = True True judge ks = [list(map(int, input().split())) for i in range(m)] [list(map(int, input().split())) for i in range(m)] ks ans = 0 0 ans switch = [('off') for _ in range(n)] [('off') for _ in range(n)] switch n, m = map(int, input().split()) map(int, input().split()) n count = 0 0 count ans += 1 1 ans m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
ks = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0

for i in range(2**n):
    judge = True
    switch = [('off') for _ in range(n)]
    for j in range(len(switch)):
        if (i >> j) & 1:
            switch[j] = 'on'
    for k in range(m):
        count = 0
        for l in range(ks[k][0]):
            if switch[ks[k][l+1]-1] == 'on':
                count += 1
        if count % 2 != p[k]:
            judge = False
            break
    if judge == True:
        ans += 1

print(ans)