from collections import Counter

from scipy.misc import comb



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

ac = Counter(int(x) & 1 for x in input().split())



ans = 0



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

    ans += comb(ac[1], c, exact=True)



ans <<= ac[0]



print(ans)

from collections import Counter

from scipy.misc import comb



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

ac = Counter(int(x) & 1 for x in input().split())

print((sum(comb(ac[1], c, exact=True) for c in range(p, ac[1] + 1, 2)) << ac[0]))

from collections import Counter
from scipy.misc import comb

n, p = list(map(int, input().split()))
ac = Counter(int(x) & 1 for x in input().split())
ans = 0
for c in range(p, ac[1] + 1, 2):
    ans += comb(ac[1], c, exact=True)
ans <<= ac[0]
print(ans)

from collections import Counter
from scipy.misc import comb

n, p = list(map(int, input().split()))
ac = Counter(int(x) & 1 for x in input().split())
print((sum(comb(ac[1], c, exact=True) for c in range(p, ac[1] + 1, 2)) << ac[0]))

-ans = 0 -for c in range(p, ac[1] + 1, 2): -    ans += comb(ac[1], c, exact=True) -ans <<= ac[0] -print(ans) +print((sum(comb(ac[1], c, exact=True) for c in range(p, ac[1] + 1, 2)) << ac[0]))