import math

 

def combination(n, k):

    return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

 



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



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



gu = 0



ki = 0



for i in t:

    if i%2==0:

        gu += 1

    else:

        ki += 1



gukumi = 0



kikumi = 0



for i in range(1,gu+1):

    gukumi += combination(gu,i)



if p == 0:

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

        kikumi += combination(ki,i)

    ans = kikumi+1+gukumi

else:

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

        kikumi += combination(ki,i)

    ans = kikumi

    



ans += gukumi*kikumi



print(ans)
import math

 

def combination(n, k):

    return math.factorial(n) // math.factorial(k) // math.factorial(n - k)    



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



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



kisu = 0

gusu = 0



for a in A:

    if a%2 == 0:

        gusu += 1

    else:

        kisu += 1



sum_gu = 2**gusu



if P%2==0:

    sum_ki = 0

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

        sum_ki += combination(kisu, i)

    sum_ki *= sum_gu

    print((sum_gu+sum_ki))

else:

    sum_ki = 0

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

        sum_ki += combination(kisu, i)

    print((sum_gu*sum_ki))
import math


def combination(n, k):
    return math.factorial(n) // math.factorial(k) // math.factorial(n - k)


n, p = list(map(int, input().split()))
t = list(map(int, input().split()))
gu = 0
ki = 0
for i in t:
    if i % 2 == 0:
        gu += 1
    else:
        ki += 1
gukumi = 0
kikumi = 0
for i in range(1, gu + 1):
    gukumi += combination(gu, i)
if p == 0:
    for i in range(2, ki + 1, 2):
        kikumi += combination(ki, i)
    ans = kikumi + 1 + gukumi
else:
    for i in range(1, ki + 1, 2):
        kikumi += combination(ki, i)
    ans = kikumi
ans += gukumi * kikumi
print(ans)

import math


def combination(n, k):
    return math.factorial(n) // math.factorial(k) // math.factorial(n - k)


N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
kisu = 0
gusu = 0
for a in A:
    if a % 2 == 0:
        gusu += 1
    else:
        kisu += 1
sum_gu = 2**gusu
if P % 2 == 0:
    sum_ki = 0
    for i in range(2, kisu + 1, 2):
        sum_ki += combination(kisu, i)
    sum_ki *= sum_gu
    print((sum_gu + sum_ki))
else:
    sum_ki = 0
    for i in range(1, kisu + 1, 2):
        sum_ki += combination(kisu, i)
    print((sum_gu * sum_ki))

-n, p = list(map(int, input().split())) -t = list(map(int, input().split())) -gu = 0 -ki = 0 -for i in t: -    if i % 2 == 0: -        gu += 1 +N, P = list(map(int, input().split())) +A = list(map(int, input().split())) +kisu = 0 +gusu = 0 +for a in A: +    if a % 2 == 0: +        gusu += 1 -        ki += 1 -gukumi = 0 -kikumi = 0 -for i in range(1, gu + 1): -    gukumi += combination(gu, i) -if p == 0: -    for i in range(2, ki + 1, 2): -        kikumi += combination(ki, i) -    ans = kikumi + 1 + gukumi +        kisu += 1 +sum_gu = 2**gusu +if P % 2 == 0: +    sum_ki = 0 +    for i in range(2, kisu + 1, 2): +        sum_ki += combination(kisu, i) +    sum_ki *= sum_gu +    print((sum_gu + sum_ki)) -    for i in range(1, ki + 1, 2): -        kikumi += combination(ki, i) -    ans = kikumi -ans += gukumi * kikumi -print(ans) +    sum_ki = 0 +    for i in range(1, kisu + 1, 2): +        sum_ki += combination(kisu, i) +    print((sum_gu * sum_ki))