from collections import Counter

def combination(n, r): # nCrを求める

    r = min(n-r, r)

    result = 1

    for i in range(n, n-r, -1):

        result *= i

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

        result //= i

    return result

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

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

for i in range(n):

    a[i] = a[i]%2

b = Counter(a)

c = b[1]

d = b[0]

ans = 0

if p ==0:

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

        ans += combination(c,i)

else:

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

        ans += combination(c, i)

ans *= 2**d

print(ans)
n, m = list(map(int,input().split()))

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

a = [i%2 for i in a]

if sum(a)>0:print((2**(n-1)))

else:

    if m == 0:print((2**n))

    else:print((0))
from collections import Counter


def combination(n, r):  # nCrを求める
    r = min(n - r, r)
    result = 1
    for i in range(n, n - r, -1):
        result *= i
    for i in range(1, r + 1):
        result //= i
    return result


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

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = [i % 2 for i in a]
if sum(a) > 0:
    print((2 ** (n - 1)))
else:
    if m == 0:
        print((2**n))
    else:
        print((0))

-from collections import Counter - - -def combination(n, r):  # nCrを求める -    r = min(n - r, r) -    result = 1 -    for i in range(n, n - r, -1): -        result *= i -    for i in range(1, r + 1): -        result //= i -    return result - - -n, p = list(map(int, input().split())) +n, m = list(map(int, input().split())) -for i in range(n): -    a[i] = a[i] % 2 -b = Counter(a) -c = b[1] -d = b[0] -ans = 0 -if p == 0: -    for i in range(0, c + 1, 2): -        ans += combination(c, i) +a = [i % 2 for i in a] +if sum(a) > 0: +    print((2 ** (n - 1))) -    for i in range(1, c + 1, 2): -        ans += combination(c, i) -ans *= 2**d -print(ans) +    if m == 0: +        print((2**n)) +    else: +        print((0))