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)
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))
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)

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))

-C = {0: 0, 1: 0} +n0 = 0 +n1 = 0 -        C[0] += 1 +        n0 += 1 +n1 = N - n0 +if P == 0: +    if n1 == 0: +        print((2**n0)) -        C[1] += 1 -if P == 0: -    if C[1] == 0: -        n = 2 ** C[0] +        print((2 ** (n1 - 1) * 2**n0)) +else: +    if n1 == 0: +        print((0)) -        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) +        print((2 ** (n1 - 1) * 2**n0))