from scipy.misc import comb

from math import factorial



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

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



e = len([a for a in A if a % 2 == 0])

o = N - e



ans = 0

if P == 0:

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

    ans += comb(o, i, exact=True)

  print((ans * pow(2, e)))

else:

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

    ans += comb(o, i, exact=True)

  print((ans * pow(2, e)))
from math import factorial



def combi(n, k):

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



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

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



e = len([a for a in A if a % 2 == 0])

o = N - e



ans = 0

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

  ans += combi(o, i)

print((ans * pow(2, e)))
from scipy.misc import comb
from math import factorial

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
e = len([a for a in A if a % 2 == 0])
o = N - e
ans = 0
if P == 0:
    for i in range(0, o + 1, 2):
        ans += comb(o, i, exact=True)
    print((ans * pow(2, e)))
else:
    for i in range(1, o + 1, 2):
        ans += comb(o, i, exact=True)
    print((ans * pow(2, e)))

from math import factorial


def combi(n, k):
    return factorial(n) // factorial(n - k) // factorial(k)


N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
e = len([a for a in A if a % 2 == 0])
o = N - e
ans = 0
for i in range(P, o + 1, 2):
    ans += combi(o, i)
print((ans * pow(2, e)))

-from scipy.misc import comb + + +def combi(n, k): +    return factorial(n) // factorial(n - k) // factorial(k) + -if P == 0: -    for i in range(0, o + 1, 2): -        ans += comb(o, i, exact=True) -    print((ans * pow(2, e))) -else: -    for i in range(1, o + 1, 2): -        ans += comb(o, i, exact=True) -    print((ans * pow(2, e))) +for i in range(P, o + 1, 2): +    ans += combi(o, i) +print((ans * pow(2, e)))