from scipy.misc import comb

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

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

B = [0] * N

for i in range(N):

    B[i] = A[i] % 2



num_1 = sum(B)

num_0 = N - num_1

cnt_num_1 = 0

for i in range(1, num_1+1, 2):

    cnt_num_1 += comb(num_1, i, exact=True) * (2 ** num_0)



if P == 1:

    print(cnt_num_1)

else:

    print((2 ** N - cnt_num_1))
N, P = list(map(int, input().split()))

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

num_0 = 0

num_1 = 0

for i in range(N):

    if A[i] % 2 == 0:

        num_0 += 1

    else:

        num_1 += 1

if num_1 == 0:

    if P == 1:

        ans = 0

    else:

        ans = 2 ** N

else:

    ans = 2 ** (N-1)



print(ans)
from scipy.misc import comb

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [0] * N
for i in range(N):
    B[i] = A[i] % 2
num_1 = sum(B)
num_0 = N - num_1
cnt_num_1 = 0
for i in range(1, num_1 + 1, 2):
    cnt_num_1 += comb(num_1, i, exact=True) * (2**num_0)
if P == 1:
    print(cnt_num_1)
else:
    print((2**N - cnt_num_1))

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
num_0 = 0
num_1 = 0
for i in range(N):
    if A[i] % 2 == 0:
        num_0 += 1
    else:
        num_1 += 1
if num_1 == 0:
    if P == 1:
        ans = 0
    else:
        ans = 2**N
else:
    ans = 2 ** (N - 1)
print(ans)

-from scipy.misc import comb - -B = [0] * N +num_0 = 0 +num_1 = 0 -    B[i] = A[i] % 2 -num_1 = sum(B) -num_0 = N - num_1 -cnt_num_1 = 0 -for i in range(1, num_1 + 1, 2): -    cnt_num_1 += comb(num_1, i, exact=True) * (2**num_0) -if P == 1: -    print(cnt_num_1) +    if A[i] % 2 == 0: +        num_0 += 1 +    else: +        num_1 += 1 +if num_1 == 0: +    if P == 1: +        ans = 0 +    else: +        ans = 2**N -    print((2**N - cnt_num_1)) +    ans = 2 ** (N - 1) +print(ans)