def f(i):
    if i == n:
        on = [0] * m
        for j in range(m):
            for k in range(1, s[j][0] + 1):
                if t[s[j][k] - 1]:
                    on[j] += 1
        for j in range(m):
            if not on[j] % 2 == p[j]:
                return
        global ans
        ans += 1
        return
    t[i] = 1
    f(i + 1)
    t[i] = 0
    f(i + 1)
    return

n, m = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
t = [0] * n
f(0)
print(ans) def f(i):
    if i == n:
        on = [0] * m
        for j in range(m):
            for k in range(1, s[j][0] + 1):
                if t[s[j][k] - 1]:
                    on[j] += 1
        for j in range(m):
            if not on[j] % 2 == p[j]:
                return
        global ans
        ans += 1
        return
    t[i] = 1
    f(i + 1)
    t[i] = 0
    f(i + 1)
    return f if i == n:
        on = [0] * m
        for j in range(m):
            for k in range(1, s[j][0] + 1):
                if t[s[j][k] - 1]:
                    on[j] += 1
        for j in range(m):
            if not on[j] % 2 == p[j]:
                return
        global ans
        ans += 1
        return
     i == n i n on = [0] * m on [0] * m [0] 0 m for j in range(m):
            for k in range(1, s[j][0] + 1):
                if t[s[j][k] - 1]:
                    on[j] += 1
         j range(m) range m for k in range(1, s[j][0] + 1):
                if t[s[j][k] - 1]:
                    on[j] += 1
         k range(1, s[j][0] + 1) range 1 s[j][0] + 1 s[j][0] [j] s j 0 1 if t[s[j][k] - 1]:
                    on[j] += 1
         t[s[j][k] - 1] t s[j][k] - 1 s[j][k] [j] s j k 1 on[j] += 1 on[j] on j 1 for j in range(m):
            if not on[j] % 2 == p[j]:
                return
         j range(m) range m if not on[j] % 2 == p[j]:
                return
         not on[j] % 2 == p[j] on[j] % 2 == p[j] on[j] % 2 on[j] on j 2 p[j] p j return global ans ans += 1 ans 1 return t[i] = 1 t[i] t i 1 f(i + 1) f i + 1 i 1 t[i] = 0 t[i] t i 0 f(i + 1) f i + 1 i 1 return i i 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 _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split s = [list(map(int, input().split())) for _ in range(m)] s [list(map(int, input().split())) 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 ans = 0 ans 0 t = [0] * n t [0] * n [0] 0 n f(0) f 0 print(ans) print ans def f(i):
    if i == n:
        on = [0] * m
        for j in range(m):
            for k in range(1, s[j][0] + 1):
                if t[s[j][k] - 1]:
                    on[j] += 1
        for j in range(m):
            if not on[j] % 2 == p[j]:
                return
        global ans
        ans += 1
        return
    t[i] = 1
    f(i + 1)
    t[i] = 0
    f(i + 1)
    return def f(i):
    if i == n:
        on = [0] * m
        for j in range(m):
            for k in range(1, s[j][0] + 1):
                if t[s[j][k] - 1]:
                    on[j] += 1
        for j in range(m):
            if not on[j] % 2 == p[j]:
                return
        global ans
        ans += 1
        return
    t[i] = 1
    f(i + 1)
    t[i] = 0
    f(i + 1)
    return f m = map(int, input().split()) map(int, input().split()) m n, m = map(int, input().split()) map(int, input().split()) n p = list(map(int, input().split())) list(map(int, input().split())) p t = [0] * n [0] * n t s = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] s ans = 0 0 ans
def f(i):
    if i == n:
        on = [0] * m
        for j in range(m):
            for k in range(1, s[j][0] + 1):
                if t[s[j][k] - 1]:
                    on[j] += 1
        for j in range(m):
            if not on[j] % 2 == p[j]:
                return
        global ans
        ans += 1
        return
    t[i] = 1
    f(i + 1)
    t[i] = 0
    f(i + 1)
    return

n, m = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
t = [0] * n
f(0)
print(ans)