from functools import reduce



def binom(n, r):

    if n < r or n < 0 or r < 0: return 0

    

    if n - r < r: r = n - r

    if r == 0: return 1

    elif r == 1: return n



    numerator = [n - r + 1 + k for k in range(r)]  # (n-r+1)*(n-r+2)*...*(n-1)*n

    denominator = [1+ k for k in range(r)]         # 1*2*...*(r-1)*r



    # reduce prod(numerator)//prod(denominator)

    for p in range(2, r+1):

        pivot = denominator[p - 1]

        if pivot > 1:

            offset = (n - r) % p

            for k in range(p-1, r, p):

                numerator[k - offset] //= pivot

                denominator[k] //= pivot

    

    # calculate nCr

    return reduce(lambda x, y: x*y, numerator)



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

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

even = 0; odd = 0;

for a in A:

    if a % 2 == 0:

        even += 1

    else:

        odd += 1

ans = 2**even

temp = 0

if P == 0:

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

        temp += binom(odd, i)

else:

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

        temp += binom(odd, i)

ans *= temp

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

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

even = 0

for a in A:

    if a % 2 == 0:

        even += 1

if even == N:

    print((2**N if P == 0 else 0))

else:

    print((2**(N-1)))
from functools import reduce


def binom(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    elif r == 1:
        return n
    numerator = [n - r + 1 + k for k in range(r)]  # (n-r+1)*(n-r+2)*...*(n-1)*n
    denominator = [1 + k for k in range(r)]  # 1*2*...*(r-1)*r
    # reduce prod(numerator)//prod(denominator)
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] //= pivot
                denominator[k] //= pivot
    # calculate nCr
    return reduce(lambda x, y: x * y, numerator)


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

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

-from functools import reduce - - -def binom(n, r): -    if n < r or n < 0 or r < 0: -        return 0 -    if n - r < r: -        r = n - r -    if r == 0: -        return 1 -    elif r == 1: -        return n -    numerator = [n - r + 1 + k for k in range(r)]  # (n-r+1)*(n-r+2)*...*(n-1)*n -    denominator = [1 + k for k in range(r)]  # 1*2*...*(r-1)*r -    # reduce prod(numerator)//prod(denominator) -    for p in range(2, r + 1): -        pivot = denominator[p - 1] -        if pivot > 1: -            offset = (n - r) % p -            for k in range(p - 1, r, p): -                numerator[k - offset] //= pivot -                denominator[k] //= pivot -    # calculate nCr -    return reduce(lambda x, y: x * y, numerator) - - -odd = 0 -    else: -        odd += 1 -ans = 2**even -temp = 0 -if P == 0: -    for i in range(0, odd + 1, 2): -        temp += binom(odd, i) +if even == N: +    print((2**N if P == 0 else 0)) -    for i in range(1, odd + 1, 2): -        temp += binom(odd, i) -ans *= temp -print(ans) +    print((2 ** (N - 1)))