from collections import Counter





def modinv(a, mod=10**9+7):

    return pow(a, mod-2, mod)





def combination(n, r, mod=10**9+7):

    """

    nCr mod m

    """

    if n < r:

        return 0

    r = min(r, n-r)

    res = 1

    for i in range(r):

        res = res * (n - i) * modinv(i+1, mod) % mod

    return res





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

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

b = [ai % 2 for ai in a]

c = Counter(b)



ans = 0

if p == 0:

    even = (2 ** c[0])

    odd = 1

    for i in range(2, c[1] + 1, 2):

        odd += combination(c[1], i)

    ans = even * odd

else:

    even = (2 ** c[0])

    odd = 0

    for i in range(1, c[1] + 1, 2):

        odd += combination(c[1], i)

    ans = even * odd



print(ans)
import math





def combination(n, r):

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





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

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



odd = 0

even = 0

for a in A:

    if a % 2 == 0:

        even += 1

    else:

        odd += 1



ans = 0

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

    tmp = combination(odd, i)

    for j in range(0, even+1):

        ans += tmp * combination(even, j)

print(ans)

from collections import Counter


def modinv(a, mod=10**9 + 7):
    return pow(a, mod - 2, mod)


def combination(n, r, mod=10**9 + 7):
    """
    nCr mod m
    """
    if n < r:
        return 0
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i + 1, mod) % mod
    return res


n, p = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [ai % 2 for ai in a]
c = Counter(b)
ans = 0
if p == 0:
    even = 2 ** c[0]
    odd = 1
    for i in range(2, c[1] + 1, 2):
        odd += combination(c[1], i)
    ans = even * odd
else:
    even = 2 ** c[0]
    odd = 0
    for i in range(1, c[1] + 1, 2):
        odd += combination(c[1], i)
    ans = even * odd
print(ans)

import math


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


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

-from collections import Counter +import math -def modinv(a, mod=10**9 + 7): -    return pow(a, mod - 2, mod) +def combination(n, r): +    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) -def combination(n, r, mod=10**9 + 7): -    """ -    nCr mod m -    """ -    if n < r: -        return 0 -    r = min(r, n - r) -    res = 1 -    for i in range(r): -        res = res * (n - i) * modinv(i + 1, mod) % mod -    return res - - -n, p = list(map(int, input().split())) -a = list(map(int, input().split())) -b = [ai % 2 for ai in a] -c = Counter(b) +N, P = list(map(int, input().split())) +A = list(map(int, input().split())) +odd = 0 +even = 0 +for a in A: +    if a % 2 == 0: +        even += 1 +    else: +        odd += 1 -if p == 0: -    even = 2 ** c[0] -    odd = 1 -    for i in range(2, c[1] + 1, 2): -        odd += combination(c[1], i) -    ans = even * odd -else: -    even = 2 ** c[0] -    odd = 0 -    for i in range(1, c[1] + 1, 2): -        odd += combination(c[1], i) -    ans = even * odd +for i in range(P, odd + 1, 2): +    tmp = combination(odd, i) +    for j in range(0, even + 1): +        ans += tmp * combination(even, j)