CodeEff/ECCO huggingface dataset:
# Original solution
a, b = list(map(int, input().split()))
if a == 1 and b != 1:
    print('Alice')
elif a != 1and b == 1:
    print('Bob')
else:
    if a > b:
        print('Alice')
    elif b > a:
        print('Bob')
    else:
        print('Draw')

# Optimized solution
a, b = list(map(int, input().split()))

if a == 1 and b == 1:
    print('Draw')
elif a == 1:
    print('Alice')
elif b == 1:
    print('Bob')
else:
    if a == b:
        print('Draw')
    elif a > b:
        print('Alice')
    else:
        print('Bob')
# Original solution
A,B = list(map(int,input().split()))
def operate(i):
    if i == 1:
        i += 13
    return i
A = operate(A)
B = operate(B)
ans = ["Alice","Bob","Draw"]
if A > B:
    ans_index = 0
elif A < B:
    ans_index = 1
elif A == B:
    ans_index = 2
print((ans[ans_index]))

# Optimized solution
A,B = list(map(int,input().split()))

if A == 1:
    A += 100
if B == 1:
    B += 100

if A > B:
    print("Alice")
elif A < B:
    print("Bob")
else:
    print("Draw")
# Original solution
import sys

def shuffle( cards ):
	h = int( sys.stdin.readline() )
	n = len( cards )
	s = ""
	t = ""
	for i in range( h ):
		s += cards[i]
	for i in range( h, n ):
		t += cards[i]
	t += s
	return t

while True:
	cards = sys.stdin.readline().rstrip()
	if '-' == cards:
		break
	m = int( sys.stdin.readline() )
	for i in range( 0, m ):
		cards = shuffle( cards )
	print( cards )

# Optimized solution
import sys

def shuffle( cards ):
	h = int( sys.stdin.readline() )
	cards = cards[ h : ] + cards[ 0 : h ]
	return cards

while True:
	cards = sys.stdin.readline().rstrip()
	if '-' == cards:
		break
	m = int( sys.stdin.readline() )
	for i in range( m ):
		cards = shuffle( cards )
	print( cards )
# Original solution
import sys

p = 0
for line in sys.stdin:
    ls = line.strip('\n')
    if p == 0:
        if ls =='-': break
        letters = ls
        p = 1
    elif p == 1:
        m = int(ls)
        p =2
    elif p == 2:
        h = int(ls)
        letters = letters[h:] + letters[:h]
        if m > 1:
            m -= 1
        else:
            print(letters)
            p = 0

# Optimized solution
while True:
    ls = input()
    if ls == '-': break

    m = int(input())
    for i in range(m):
        h = int(input())
        ls = ls[h:] + ls[:h]
    print(ls)
# Original solution
from operator import mul
from functools import reduce

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
cE, cO = 0, 0

for a in A:
    if a % 2 == 0:
        cE += 1
    else:
        cO += 1


# 全て偶数
if cO == 0:
    ans = 2 ** N if P == 0 else 0
    print(ans)
else:
    # 偶数が含まれている
    # ある奇数$k$について考える
    # 残りの奇数がcO-1個，偶数がcE個残っている，この選び方は2 ** (N - 1)通り
    # 選んだ合計がSとする
    # - Sが奇数である: Akを選ぶと全体は偶数，選ばないと全体は奇数
    # - Sが偶数である: Akを選ぶと全体は奇数，選ばないと全体は偶数
    # よってそれぞれの2 ** (N - 1)通りについて，Akを選ぶ・選ばないが1通り存在する
    # print(2 ** (cO - 1) * 2 ** cE)
    print((2 ** (N - 1)))

# Optimized solution
from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N, P = list(map(int, input().split()))
    A = list(map(int, input().split()))
    

    count_even, count_odd = 0, 0
    for a in A:
        if a % 2 == 0:
            count_even += 1
        else:
            count_odd += 1
    
    ans = -1
    # print(N, P, A)
    # print(count_even, count_odd)
    if count_odd == 0:
        # 偶数しかない
        if P == 0:
            # 偶数にしたい => どれでもOK
            ans = 2 ** N
        else:
            # 奇数枚は食べられない
            ans = 0
    else:
        # 奇数が1以上存在するので，ある1つ以外の和Sを考える
        # S is odd: 食べたらeven，食べないとodd => 2 ^ (N-1) パターン
        # S is even: 食べたらodd，食べないとeven
        ans = 2 ** (N - 1)
    print(ans)


if __name__ == '__main__':
    main()
# Original solution
N, P = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

import collections
import math

c = collections.Counter()

for a in A:
    c[a % 2] += 1

ans = 0
if P == 0:
    ans1 = 0
    for i in range(0, c[1] + 1, 2):
        ans1 += math.factorial(c[1]) / math.factorial(i) / math.factorial(c[1] - i)

    for i in range(c[0] + 1):
        ans0 = math.factorial(c[0]) / math.factorial(i) / math.factorial(c[0] - i)
        ans += ans0 * ans1
else:
    ans1 = 0
    for i in range(1, c[1] + 1, 2):
        ans1 += math.factorial(c[1]) / math.factorial(i) / math.factorial(c[1] - i)

    for i in range(c[0] + 1):
        ans0 = math.factorial(c[0]) / math.factorial(i) / math.factorial(c[0] - i)
        ans += ans0 * ans1


print((int(ans)))


# Optimized solution
import sys
import math

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, P = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]

    odd = 0
    even = 0
    ans = 0
    def comb(n, r):
        return math.factorial(n) // math.factorial(r) // math.factorial(n - r)
    for a in A:
        if a % 2 == 0:
            even += 1
        else:
            odd += 1

    if P == 0:
        for i in range(0, odd + 1, 2):
            for j in range(even + 1):
                ans += comb(odd, i) * comb(even, j)
        print(ans)
    else:
        for i in range(1, odd + 1, 2):
            for j in range(even + 1):
                ans += comb(odd, i) * comb(even, j)
        print(ans)


if __name__ == '__main__':
    main()
# Original solution
n,p=list(map(int,input().split()))
a=[int(i) for i in input().split()]
odd=0
for i in a:
    if i%2: odd+=1
even=n-odd
if odd==0:
    print((2**n if p==0 else 0))
else:
    print((2**(n-1)))


# Optimized solution
n,p=list(map(int,input().split()))
a=[i for i in input().split() if int(i)%2]
if len(a)==0:
    print((2**n if p==0 else 0))
else:
    print((2**(n-1)))
# Original solution
n,p=list(map(int,input().split()))
a=[i for i in input().split() if int(i)%2]
if len(a)==0:
    print((2**n if p==0 else 0))
else:
    print((2**(n-1)))

# Optimized solution
n,p=list(map(int,input().split()))
a=len([i for i in input().split() if int(i)%2])
print((2**(n-1) if a else 2**n if p==0 else 0))
# Original solution
import math
from itertools import combinations_with_replacement

n, p = list(map(int, input().split()))
A = list(map(int, input().split()))
odd = []
even = []


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


for a in A:
    if a % 2 == 0:
        even.append(a)
    else:
        odd.append(a)
even_count = []
for i in range(len(even)+1):
    even_count.append(combinations_count(len(even), i))
odd_odd_count = []
odd_even_count = []
for i in range(len(odd)+1):
    cnt = combinations_count(len(odd), i)
    if i % 2 == 1:
        odd_odd_count.append(cnt)
    else:
        odd_even_count.append(cnt)
ans = 0
if p == 0:
    for i in even_count:
        for j in odd_even_count:
            ans += i*j
else:
    for i in even_count:
        for j in odd_odd_count:
            ans += i*j

print(ans)


# Optimized solution
n, p = list(map(int, input().split()))
A = list(map(int, input().split()))
if all(a % 2 == 0 for a in A):
    print((0 if p else 2**n))
else:
    print((2**(n-1)))
# Original solution
def main():
    N, P = (int(i) for i in input().split())
    A = [int(i) % 2 for i in input().split()]
    from collections import Counter
    c = Counter(A)
    if all(a == 0 for a in A):
        print((2**N if P == 0 else 0))
    else:
        print((2**(c[1]-1) * 2**c[0]))


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, P = (int(i) for i in input().split())
    A = [int(i) % 2 for i in input().split()]
    from collections import Counter
    c = Counter(A)
    if all(a == 0 for a in A):
        print((2**N if P == 0 else 0))
    else:
        print((2**(c[1]-1) * 2**c[0]))


if __name__ == '__main__':
    main()
# Original solution
from operator import mul
from functools import reduce

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

even = 0
odd = 0
for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, list(range(n, n - r, -1)))
    under = reduce(mul, list(range(1, r + 1)))
    return over // under


ans = 2**even
cnt = 0
if p == 0:
    for i in range(0, odd+1, 2):
        cnt += cmb(odd, i)
else:
    for i in range(1, odd+1, 2):
        cnt += cmb(odd, i)

print((ans*cnt))


# Optimized solution
n, p = list(map(int, input().split()))
A = list(map(int, input().split()))

odd = False
for a in A:
    if a % 2 == 1:
        odd = True
        break

if odd:
    print((2**(n-1)))
elif p == 0:
    print((2**n))
else:
    print((0))
# Original solution
import math
def comb(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()))
o, e = 0, 0
for i in A:
    if i % 2 == 0:
        e += 1
    else:
        o += 1
ans = 0
for i in range(P, o+1, 2):
    ans += comb(o, i)
print((ans * 2 ** e))


# Optimized solution
N,P=list(map(int,input().split()))
o=len([i for i in input().split() if int(i)%2])
print((2**(N-1) if o else 2**N if P==0 else 0))
# Original solution
from operator import mul
from functools import reduce
from math import factorial

def cmb(n,r):
  r=min(n-r,r)
  if r == 0: return 1
  over=reduce(mul,list(range(n,n-r,-1)))
  under=reduce(mul,list(range(1,r+1)))
  return over//under

n,p,*a=list(map(int,open(0).read().split()))
b=[i for i in a if i%2==0]
c=[i for i in a if i%2==1]
ans=0
x=0
for s in range(len(b)+1):
  x+=cmb(len(b),s)
if p==0:
  for s in range(0,len(c)+1,2):
    ans+=x*cmb(len(c),s)
  print(ans)
else:
  for s in range(1,len(c)+1,2):
    ans+=x*cmb(len(c),s)
  print(ans)

# Optimized solution
from math import factorial
def cmb(n,r):
    if n-r<0:
        return 0
    else:
        return factorial(n) // factorial(r) // factorial(n - r)
        

n,p,*a=list(map(int,open(0).read().split()))

odd=sum(i%2 for i in a)
even=n-odd


x=sum(cmb(even,i)for i in range(even+1))
y=sum(cmb(odd,i)for i in range(p,odd+1,2))
print((x*y))
# Original solution
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy


def odd(n): return n & 1


def even(n): return not odd(n)


def comb(n, m):
    r = 1
    for i in range(1, n+1):
        r *= i
    for i in range(1, m+1):
        r //= i
    for i in range(1, n-m+1):
        r //= i
    return r


N, P = map(int, input().split())
A = [int(n) % 2 for n in input().split()]
cnt0 = len([a for a in A if a == 0])
cnt1 = len([a for a in A if a == 1])
ans = 0
if odd(P):
    for i in range(cnt1 + 1):
        if odd(i):
            ans += comb(cnt1, i)
else:
    for i in range(cnt1 + 1):
        if even(i):
            ans += comb(cnt1, i)
ans *= pow(2, cnt0)
print(ans)


# Optimized solution
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy


def odd(n): return n & 1


def even(n): return not odd(n)


def comb(n, m):
    r = 1
    for i in range(1, n+1):
        r *= i
    for i in range(1, m+1):
        r //= i
    for i in range(1, n-m+1):
        r //= i
    return r


N, P = map(int, input().split())
A = [int(n) % 2 for n in input().split()]
cnt0 = len([a for a in A if a == 0])
cnt1 = len([a for a in A if a == 1])
ans = 0
if odd(P):
    for i in range(cnt1 + 1):
        if odd(i):
            ans += comb(cnt1, i)
else:
    for i in range(cnt1 + 1):
        if even(i):
            ans += comb(cnt1, i)
ans *= pow(2, cnt0)
print(ans)
# Original solution
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy


def odd(n): return n & 1


def even(n): return not odd(n)


def comb(n, m):
    r = 1
    for i in range(1, n+1):
        r *= i
    for i in range(1, m+1):
        r //= i
    for i in range(1, n-m+1):
        r //= i
    return r


if __name__ == '__main__':
    N, P = map(int, input().split())
    A = [int(n) % 2 for n in input().split()]
    cnt0 = len([a for a in A if a == 0])
    cnt1 = len([a for a in A if a == 1])
    ans = 0
    if odd(P):
        for i in range(cnt1 + 1):
            if odd(i):
                ans += comb(cnt1, i)
    else:
        for i in range(cnt1 + 1):
            if even(i):
                ans += comb(cnt1, i)
    ans *= pow(2, cnt0)
    print(ans)


# Optimized solution
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy


def odd(n): return n & 1


def even(n): return not odd(n)


def comb(n, m):
    r = 1
    for i in range(1, n+1):
        r *= i
    for i in range(1, m+1):
        r //= i
    for i in range(1, n-m+1):
        r //= i
    return r


N, P = map(int, input().split())
A = [int(n) % 2 for n in input().split()]
cnt0 = len([a for a in A if a == 0])
cnt1 = len([a for a in A if a == 1])
ans = 0
if odd(P):
    for i in range(cnt1 + 1):
        if odd(i):
            ans += comb(cnt1, i)
else:
    for i in range(cnt1 + 1):
        if even(i):
            ans += comb(cnt1, i)
ans *= pow(2, cnt0)
print(ans)
# Original solution
from math import factorial

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
odd, even = 0, 0
for i in range(N):
    if A[i] % 2:
        odd += 1
    else:
        even += 1

ans = 0
for i in range(odd+1):
    if i%2 == P:
        ans += factorial(odd) / factorial(i) / factorial(odd-i)
ans *= 2**even

print((int(ans)))


# Optimized solution
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
odd, even = 0, 0
for i in range(N):
    if A[i] % 2:
        odd += 1
    else:
        even += 1
if odd == 0:
    if P:
        ans = 0
    else:
        ans = 2**N
else:
    ans = 2**(N-1)

print((int(ans)))
# Original solution
from functools import reduce

def binom(n, r):
    if n < r or n < 0 or r < 0: return 0
    
    if n - r < r: r = n - r
    if r == 0: return 1
    elif r == 1: return n

    numerator = [n - r + 1 + k for k in range(r)]  # (n-r+1)*(n-r+2)*...*(n-1)*n
    denominator = [1+ k for k in range(r)]         # 1*2*...*(r-1)*r

    # reduce prod(numerator)//prod(denominator)
    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] //= pivot
                denominator[k] //= pivot
    
    # calculate nCr
    return reduce(lambda x, y: x*y, numerator)

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

# Optimized solution
N, P = list(map(int, input().split()))
*A, = list(map(int, input().split()))
even = 0
for a in A:
    if a % 2 == 0:
        even += 1
if even == N:
    print((2**N if P == 0 else 0))
else:
    print((2**(N-1)))
# Original solution
def C(n,m):
    S=1
    for i in range(1,n+1):
        S=S*i
    for i in range(1,m+1):
        S=S//i
    for i in range(1,n-m+1):
        S=S//i
    return S
N,P=list(map(int,input().split()))
A=[int(i) for i in input().split()]
X=0;Y=0
#X:偶数
#Y:奇数
for i in range(N):
    if A[i]%2==0:
        X+=1
    else:
        Y+=1
Z=0
for i in range(Y+1):
    if i%2==P:
        Z+=C(Y,i)
print((Z*2**(X)))


# Optimized solution
'''
方針：各Aiをそれぞれ見て、いくつ偶数があっていくつ奇数があるかを数える。
以下偶数がX個、奇数がY個あるとする。(X+Y=N,0≦X,Y)
そしてこの問題は偶数の集合の中からの選ぶことと奇数の集合の中から選ぶことを独立に考えることができる。
よって（偶数の集合からの選び方）×（奇数の集合からの選び方）で求めることができる。
（偶数の集合からの選び方）については、どのように選んでも全体の合計を2で割った余りは変わらないので全事象を考えることができる。
よって2^Xである。
（奇数の集合からの選び方）についてはY個のうちk個（k≡P mod 2）である場合の数の合計なので
Σ[k:0→Y and k≡P mod 2]C(Y,k)である。
ただし、C(Y,k)は二項係数を表していて、Σ[k:0→Y and k≡P mod 2]は0≦k≦Nかつk≡P mod 2であるものすべてを足し合わせたという意味である。
'''
def C(n,m):
    S=1
    for i in range(1,n+1):
        S=S*i
    for i in range(1,m+1):
        S=S//i
    for i in range(1,n-m+1):
        S=S//i
    return S
N,P=list(map(int,input().split()))
A=[int(i) for i in input().split()]
X=0;Y=0
#X:偶数
#Y:奇数
for i in range(N):
    if A[i]%2==0:
        X+=1
    else:
        Y+=1
Z=0
for i in range(Y+1):
    if i%2==P:
        Z+=C(Y,i)
print((Z*2**(X)))
# Original solution
N, P = list(map(int,input().split()))
A = list(map(int,input().split()))
c = 0
for a in A:
    c += a%2
if c == 0:
    print((2**N if P == 0 else 0))
else:
    print((2**(N-1)))


# Optimized solution
N, P = list(map(int,input().split()))
A = list(map(int,input().split()))
B = [A[k]%2 for k in range(N)]
dp = [[0,0] for k in range(N+1)]
dp[0][0] = 1

for k in range(N):
    if B[k] == 0:
        dp[k+1][0] = dp[k][0]*2
        dp[k+1][1] = dp[k][1]*2
    else:
        dp[k+1][0] = dp[k][0] + dp[k][1]
        dp[k+1][1] = dp[k][0] + dp[k][1]

print((dp[N][P]))
# Original solution
import math


N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [a % 2 for a in A]
count_0 = B.count(0)
count_1 = B.count(1)


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


x = y = 0
if count_0 == 0:
    x = 1
else:
    if P == 1 and count_1 == 0:
        x = 0
    else:
        for i in range(count_0 + 1):
            x += comb_count(count_0, i)

if count_1 == 0:
    y = 1
else:
    if P == 0:
        for i in range(0, count_1 + 1, 2):
            y += comb_count(count_1, i)
    else:
        for i in range(1, count_1 + 1, 2):
            y += comb_count(count_1, i)

print((x * y))


# Optimized solution
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [a % 2 for a in A]
count_0 = B.count(0)
count_1 = B.count(1)

if count_1 == 0:
    if P == 0:
        ans = 2 ** N
    else:
        ans = 0
else:
    ans = 2 ** (N - 1)
print(ans)
# Original solution
N,P = list(map(int,input().split()))
A = list(map(int,input().split()))
ce = 0
co = 0
for i in range(N):
    if A[i]%2==0:
        ce += 1
    else:
        co += 1
if co>0:
    n = (2**ce)*(2**(co-1))
else:
    n = 2**ce
if P==0:
    print(n)
else:
    print((2**N-n))

# Optimized solution
N,P = list(map(int,input().split()))
A = list(map(int,input().split()))
C = {0:0,1:0}
for i in range(N):
    if A[i]%2==0:
        C[0] += 1
    else:
        C[1] += 1
if P==0:
    if C[1]==0:
        n = 2**C[0]
    else:
        n = 2**C[0]*2**(C[1]-1)
else:
    if C[1]==0:
        n = 0
    else:
        n = 2**C[0]*2**(C[1]-1)
print(n)
# Original solution
N,P = list(map(int,input().split()))
A = list(map(int,input().split()))
C = {0:0,1:0}
for i in range(N):
    if A[i]%2==0:
        C[0] += 1
    else:
        C[1] += 1
if P==0:
    if C[1]==0:
        n = 2**C[0]
    else:
        n = 2**C[0]*2**(C[1]-1)
else:
    if C[1]==0:
        n = 0
    else:
        n = 2**C[0]*2**(C[1]-1)
print(n)

# Optimized solution
N,P = list(map(int,input().split()))
A = list(map(int,input().split()))
n0=0
n1=0
for i in range(N):
    if A[i]%2==0:
        n0 += 1
n1 = N-n0
if P==0:
    if n1==0:
        print((2**n0))
    else:
        print((2**(n1-1)*2**n0))
else:
    if n1==0:
        print((0))
    else:
        print((2**(n1-1)*2**n0))
# Original solution
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)

# Optimized solution
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)
# Original solution
import math
def comb(n,r):
  if r>n: return 0
  else: return int(math.factorial(n)/(math.factorial(r)*math.factorial(n-r)))

N,P=list(map(int,input().split()))
A=list(map(int,input().split()))
odd=0
even=0
a=0
for i in range(N):
  if A[i]%2==0: even+=1
  else: odd+=1
  a+=A[i]
if (a-P)%2==0: flag=0
else: flag=1
n=2**even

ans=0
if flag==0:#evenの場合
  for i in range(odd//2+1):
    ans+=comb(odd,2*i)
else:#oddの場合
  for i in range(2*(n+1)//2+1):
    ans+=comb(odd,1+2*i)
print((ans*n))

# Optimized solution
N,P=list(map(int,input().split()))
A=list(map(int,input().split()))
odd=0
for i in range(N):
  if A[i]%2==1: odd+=1
if odd==0:
  if P==1: print((0))
  else: print((2**N))
else:
  print((2**(N-1)))
# Original solution
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))

from math import ceil
def comb(n,r):
    ans = 1
    for i in range(r):
        ans *= n-i
    for i in range(1,r+1):
        ans //= i
    return ans

odd,even = 0,0
for a in A:
    if a%2==0:
        even += 1
    else:
        odd += 1

if P%2==0:
    ans = 0
    for i in range(int(odd/2)+1):
        ans += comb(odd,2*i)
else:
    ans = 0
    for i in range(1,ceil(odd/2)+1):
        ans += comb(odd,2*i-1)
ans *= 2**even
print(ans)

# Optimized solution
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
even = 0
odd = 0
for i in range(N):
    if A[i]%2==0:
        even += 1
    else:
        odd += 1
if odd>=1:
    ans = pow(2,even+odd-1)
elif P==0:
    ans = pow(2,even)
else:
    ans = 0
print(ans)