import math





def combinations_count(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_num = 0

even_num = 0

for a in A:

    if a % 2 == 1:

        odd_num += 1

    else:

        even_num += 1

ans = 0



if P == 1:

    if odd_num == 0:

        ans = 0

    else:

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

            ans += combinations_count(N, i)

else:

    if odd_num == 0:

        ans = 2 ** even_num

    else:

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

            ans += combinations_count(N, i)

print(ans)
from math import factorial

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

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

A = list([x % 2 for x in A])

counter = {'0': 0, '1': 0}

for a in A:

    c_a = str(a)

    counter[c_a] += 1

#print(counter)

ans = 2 ** counter['0']

tmp = factorial(counter['1'])

tmp_ans = 0

for i in range(0 + P,counter['1'] + 1,2):

    tmp_ans += tmp / factorial(i) / factorial(counter['1'] - i)

print((int(tmp_ans * ans)))

import math


def combinations_count(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_num = 0
even_num = 0
for a in A:
    if a % 2 == 1:
        odd_num += 1
    else:
        even_num += 1
ans = 0
if P == 1:
    if odd_num == 0:
        ans = 0
    else:
        for i in range(1, N + 1, 2):
            ans += combinations_count(N, i)
else:
    if odd_num == 0:
        ans = 2**even_num
    else:
        for i in range(0, N + 1, 2):
            ans += combinations_count(N, i)
print(ans)

from math import factorial

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list([x % 2 for x in A])
counter = {"0": 0, "1": 0}
for a in A:
    c_a = str(a)
    counter[c_a] += 1
# print(counter)
ans = 2 ** counter["0"]
tmp = factorial(counter["1"])
tmp_ans = 0
for i in range(0 + P, counter["1"] + 1, 2):
    tmp_ans += tmp / factorial(i) / factorial(counter["1"] - i)
print((int(tmp_ans * ans)))

-import math - - -def combinations_count(n, r): -    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) - +from math import factorial -odd_num = 0 -even_num = 0 +A = list([x % 2 for x in A]) +counter = {"0": 0, "1": 0} -    if a % 2 == 1: -        odd_num += 1 -    else: -        even_num += 1 -ans = 0 -if P == 1: -    if odd_num == 0: -        ans = 0 -    else: -        for i in range(1, N + 1, 2): -            ans += combinations_count(N, i) -else: -    if odd_num == 0: -        ans = 2**even_num -    else: -        for i in range(0, N + 1, 2): -            ans += combinations_count(N, i) -print(ans) +    c_a = str(a) +    counter[c_a] += 1 +# print(counter) +ans = 2 ** counter["0"] +tmp = factorial(counter["1"]) +tmp_ans = 0 +for i in range(0 + P, counter["1"] + 1, 2): +    tmp_ans += tmp / factorial(i) / factorial(counter["1"] - i) +print((int(tmp_ans * ans)))