N, P = list(map(int,input().split()))

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

B = [A[k]%2 for k in range(N)]

dp = [[0,0] for k in range(N+1)]

dp[0][0] = 1



for k in range(N):

    if B[k] == 0:

        dp[k+1][0] = dp[k][0]*2

        dp[k+1][1] = dp[k][1]*2

    else:

        dp[k+1][0] = dp[k][0] + dp[k][1]

        dp[k+1][1] = dp[k][0] + dp[k][1]



print((dp[N][P]))

import math

N, P = list(map(int,input().split()))

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

B = [e%2 for e in A]

ans = pow(2,B.count(0))

def nCr(n,r):

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

t = 0

for k in range(B.count(1)+1):

    if k%2 == 0:

        t += nCr(B.count(1),k)

print((ans*t if P == 0 else pow(2,N)-ans*t))

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [A[k] % 2 for k in range(N)]
dp = [[0, 0] for k in range(N + 1)]
dp[0][0] = 1
for k in range(N):
    if B[k] == 0:
        dp[k + 1][0] = dp[k][0] * 2
        dp[k + 1][1] = dp[k][1] * 2
    else:
        dp[k + 1][0] = dp[k][0] + dp[k][1]
        dp[k + 1][1] = dp[k][0] + dp[k][1]
print((dp[N][P]))

import math

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [e % 2 for e in A]
ans = pow(2, B.count(0))


def nCr(n, r):
    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))


t = 0
for k in range(B.count(1) + 1):
    if k % 2 == 0:
        t += nCr(B.count(1), k)
print((ans * t if P == 0 else pow(2, N) - ans * t))

+import math + -B = [A[k] % 2 for k in range(N)] -dp = [[0, 0] for k in range(N + 1)] -dp[0][0] = 1 -for k in range(N): -    if B[k] == 0: -        dp[k + 1][0] = dp[k][0] * 2 -        dp[k + 1][1] = dp[k][1] * 2 -    else: -        dp[k + 1][0] = dp[k][0] + dp[k][1] -        dp[k + 1][1] = dp[k][0] + dp[k][1] -print((dp[N][P])) +B = [e % 2 for e in A] +ans = pow(2, B.count(0)) + + +def nCr(n, r): +    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r)) + + +t = 0 +for k in range(B.count(1) + 1): +    if k % 2 == 0: +        t += nCr(B.count(1), k) +print((ans * t if P == 0 else pow(2, N) - ans * t))