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

A = [int(a) for a in input().split()]



even = 0

odd = 0

for a in A:

    if a%2 == 0:

        even += 1

    else:

        odd += 1



L = [1]*(N+1)

for i in range(N):

    L[i+1] = L[i]*(i+1)

    

def cmb(n, r):

    return L[n]//L[r]//L[n-r]



ans = pow(2, N)    

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

    ans -= cmb(odd, i)*pow(2, even)

if P == 1:

    ans = pow(2, N) - ans



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

A = [int(a) for a in input().split()]



even = 0

odd = 0

for a in A:

    if a%2 == 0:

        even += 1

    else:

        odd += 1



if odd == 0:

    if P == 0:

        ans = pow(2, N)

    else:

        ans = 0

else:

    ans = pow(2, N-1)



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


def cmb(n, r):
    return L[n] // L[r] // L[n - r]


ans = pow(2, N)
for i in range(1, odd + 1, 2):
    ans -= cmb(odd, i) * pow(2, even)
if P == 1:
    ans = pow(2, N) - ans
print(ans)

N, P = list(map(int, input().split()))
A = [int(a) for a in input().split()]
even = 0
odd = 0
for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1
if odd == 0:
    if P == 0:
        ans = pow(2, N)
    else:
        ans = 0
else:
    ans = pow(2, N - 1)
print(ans)

-L = [1] * (N + 1) -for i in range(N): -    L[i + 1] = L[i] * (i + 1) - - -def cmb(n, r): -    return L[n] // L[r] // L[n - r] - - -ans = pow(2, N) -for i in range(1, odd + 1, 2): -    ans -= cmb(odd, i) * pow(2, even) -if P == 1: -    ans = pow(2, N) - ans +if odd == 0: +    if P == 0: +        ans = pow(2, N) +    else: +        ans = 0 +else: +    ans = pow(2, N - 1)