from math import factorial





def cmb(n,r):

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





n,p=list(map(int,input().split()))

A=list(map(int,input().split()))

A=[A[i]%2 for i in range(n)]



cnt=A.count(0)

ans=0

for i in range(p,n-cnt+1,2):

    ans +=cmb(n-cnt,i)

print((ans*(2**cnt)))
from math import factorial

n,p=list(map(int,input().split()))

A=list(map(int,input().split()))



a,b=0,0

for i in A:

    if i%2==0:a +=1

    else:b +=1



cnt=0 if p==1 else 1

for i in range(p,b+1,2):

    if i==0:continue

    cnt +=factorial(b)//(factorial(i)*factorial(b-i))



print((cnt*(2**a)))
from math import factorial


def cmb(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))


n, p = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [A[i] % 2 for i in range(n)]
cnt = A.count(0)
ans = 0
for i in range(p, n - cnt + 1, 2):
    ans += cmb(n - cnt, i)
print((ans * (2**cnt)))

from math import factorial

n, p = list(map(int, input().split()))
A = list(map(int, input().split()))
a, b = 0, 0
for i in A:
    if i % 2 == 0:
        a += 1
    else:
        b += 1
cnt = 0 if p == 1 else 1
for i in range(p, b + 1, 2):
    if i == 0:
        continue
    cnt += factorial(b) // (factorial(i) * factorial(b - i))
print((cnt * (2**a)))

- - -def cmb(n, r): -    return factorial(n) // (factorial(n - r) * factorial(r)) - -A = [A[i] % 2 for i in range(n)] -cnt = A.count(0) -ans = 0 -for i in range(p, n - cnt + 1, 2): -    ans += cmb(n - cnt, i) -print((ans * (2**cnt))) +a, b = 0, 0 +for i in A: +    if i % 2 == 0: +        a += 1 +    else: +        b += 1 +cnt = 0 if p == 1 else 1 +for i in range(p, b + 1, 2): +    if i == 0: +        continue +    cnt += factorial(b) // (factorial(i) * factorial(b - i)) +print((cnt * (2**a)))