from operator import mul

from functools import reduce

from math import factorial



def cmb(n,r):

  r=min(n-r,r)

  if r == 0: return 1

  over=reduce(mul,list(range(n,n-r,-1)))

  under=reduce(mul,list(range(1,r+1)))

  return over//under



n,p,*a=list(map(int,open(0).read().split()))

b=[i for i in a if i%2==0]

c=[i for i in a if i%2==1]

ans=0

x=0

for s in range(len(b)+1):

  x+=cmb(len(b),s)

if p==0:

  for s in range(0,len(c)+1,2):

    ans+=x*cmb(len(c),s)

  print(ans)

else:

  for s in range(1,len(c)+1,2):

    ans+=x*cmb(len(c),s)

  print(ans)
from math import factorial

def cmb(n,r):

    if n-r<0:

        return 0

    else:

        return factorial(n) // factorial(r) // factorial(n - r)

        



n,p,*a=list(map(int,open(0).read().split()))



odd=sum(i%2 for i in a)

even=n-odd





x=sum(cmb(even,i)for i in range(even+1))

y=sum(cmb(odd,i)for i in range(p,odd+1,2))

print((x*y))



from operator import mul
from functools import reduce
from math import factorial


def cmb(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, list(range(n, n - r, -1)))
    under = reduce(mul, list(range(1, r + 1)))
    return over // under


n, p, *a = list(map(int, open(0).read().split()))
b = [i for i in a if i % 2 == 0]
c = [i for i in a if i % 2 == 1]
ans = 0
x = 0
for s in range(len(b) + 1):
    x += cmb(len(b), s)
if p == 0:
    for s in range(0, len(c) + 1, 2):
        ans += x * cmb(len(c), s)
    print(ans)
else:
    for s in range(1, len(c) + 1, 2):
        ans += x * cmb(len(c), s)
    print(ans)

from math import factorial


def cmb(n, r):
    if n - r < 0:
        return 0
    else:
        return factorial(n) // factorial(r) // factorial(n - r)


n, p, *a = list(map(int, open(0).read().split()))
odd = sum(i % 2 for i in a)
even = n - odd
x = sum(cmb(even, i) for i in range(even + 1))
y = sum(cmb(odd, i) for i in range(p, odd + 1, 2))
print((x * y))

-from operator import mul -from functools import reduce -    r = min(n - r, r) -    if r == 0: -        return 1 -    over = reduce(mul, list(range(n, n - r, -1))) -    under = reduce(mul, list(range(1, r + 1))) -    return over // under +    if n - r < 0: +        return 0 +    else: +        return factorial(n) // factorial(r) // factorial(n - r) -b = [i for i in a if i % 2 == 0] -c = [i for i in a if i % 2 == 1] -ans = 0 -x = 0 -for s in range(len(b) + 1): -    x += cmb(len(b), s) -if p == 0: -    for s in range(0, len(c) + 1, 2): -        ans += x * cmb(len(c), s) -    print(ans) -else: -    for s in range(1, len(c) + 1, 2): -        ans += x * cmb(len(c), s) -    print(ans) +odd = sum(i % 2 for i in a) +even = n - odd +x = sum(cmb(even, i) for i in range(even + 1)) +y = sum(cmb(odd, i) for i in range(p, odd + 1, 2)) +print((x * y))