N, M = [int(x) for x in input().split()]

X = [[0]*N for _ in range(M)]
for i in range(M):
    u = [int(x) for x in input().split()]
    k = u[0]
    for j in range(1, k + 1):
        X[i][u[j] - 1] = 1

p = [int(x) for x in input().split()]

ans = 0
for b in range(2**N):
    q = [0]*M
    for i in range(M):
        for j in range(N):
            if (b >> j) & 1:
                q[i] = (q[i] + X[i][j]) % 2
    if q == p:
        ans += 1

print(ans) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x N, M = [int(x) for x in input().split()] N [int(x) for x in input().split()] M [0]*N for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) [0]*N [0] 0 N X = [[0]*N for _ in range(M)] X [[0]*N for _ in range(M)] for i in range(M):
    u = [int(x) for x in input().split()]
    k = u[0]
    for j in range(1, k + 1):
        X[i][u[j] - 1] = 1 i range(M) range M int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x u = [int(x) for x in input().split()] u [int(x) for x in input().split()] k = u[0] k u[0] u 0 for j in range(1, k + 1):
        X[i][u[j] - 1] = 1 j range(1, k + 1) range 1 k + 1 k 1 X[i][u[j] - 1] = 1 X[i][u[j] - 1] [i] X i u[j] - 1 u[j] u j 1 1 int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x p = [int(x) for x in input().split()] p [int(x) for x in input().split()] ans = 0 ans 0 for b in range(2**N):
    q = [0]*M
    for i in range(M):
        for j in range(N):
            if (b >> j) & 1:
                q[i] = (q[i] + X[i][j]) % 2
    if q == p:
        ans += 1 b range(2**N) range 2**N 2 N q = [0]*M q [0]*M [0] 0 M for i in range(M):
        for j in range(N):
            if (b >> j) & 1:
                q[i] = (q[i] + X[i][j]) % 2
     i range(M) range M for j in range(N):
            if (b >> j) & 1:
                q[i] = (q[i] + X[i][j]) % 2
     j range(N) range N if (b >> j) & 1:
                q[i] = (q[i] + X[i][j]) % 2
     (b >> j) & 1 b >> j b j 1 q[i] = (q[i] + X[i][j]) % 2 q[i] q i (q[i] + X[i][j]) % 2 q[i] + X[i][j] q[i] q i X[i][j] [i] X i j 2 if q == p:
        ans += 1 q == p q p ans += 1 ans 1 print(ans) print ans k = u[0] u[0] k X = [[0]*N for _ in range(M)] [[0]*N for _ in range(M)] X u = [int(x) for x in input().split()] [int(x) for x in input().split()] u ans += 1 1 ans q = [0]*M [0]*M q N, M = [int(x) for x in input().split()] [int(x) for x in input().split()] N ans = 0 0 ans p = [int(x) for x in input().split()] [int(x) for x in input().split()] p M = [int(x) for x in input().split()] [int(x) for x in input().split()] M
N, M = [int(x) for x in input().split()]

X = [[0]*N for _ in range(M)]
for i in range(M):
    u = [int(x) for x in input().split()]
    k = u[0]
    for j in range(1, k + 1):
        X[i][u[j] - 1] = 1

p = [int(x) for x in input().split()]

ans = 0
for b in range(2**N):
    q = [0]*M
    for i in range(M):
        for j in range(N):
            if (b >> j) & 1:
                q[i] = (q[i] + X[i][j]) % 2
    if q == p:
        ans += 1

print(ans)