import itertools
n, m = list(map(int, input().split()))

ks = [[int(i) for i in  list().split()] for in range(m)]
p = [int(i) for i in list().split()]

cmt = 0

for i in range(ks[1]):
  if i%2 = p[ks[0]]:
    for r in range(i):
      cmt += itertools.combination(i, r)
print(cmt)
