import math



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

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



odd = list(filter(lambda x:(x % 2 == 1), A))

even = list(filter(lambda x:(x % 2 == 0), A))

#print(odd)

#print(even)

odd_num = len(odd)

even_num = len(even)



ans = 0



def comb(n, r ):

    return math.factorial(n) //\

           (math.factorial(r) * math.factorial(n - r))





ans = 0

for o in range(0, odd_num + 1):

    for e in range(0, even_num + 1):

        #print(o, e)

        if P == 0:

            if o % 2 == 0:

                #print(o,e, comb(odd_num, o) * comb(even_num, e))

                ans += comb(odd_num, o) * comb(even_num, e)

        else:

            if o % 2 == 1:

                ans += comb(odd_num, o) * comb(even_num, e)



print(ans)

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

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



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

    print((2 ** (N -1)))

else:

    if P == 0:

        print((2 ** N))

    else:

        print((0))
import math

N, P = map(int, input().split())
A = list(map(int, input().split()))
odd = list(filter(lambda x: (x % 2 == 1), A))
even = list(filter(lambda x: (x % 2 == 0), A))
# print(odd)
# print(even)
odd_num = len(odd)
even_num = len(even)
ans = 0


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


ans = 0
for o in range(0, odd_num + 1):
    for e in range(0, even_num + 1):
        # print(o, e)
        if P == 0:
            if o % 2 == 0:
                # print(o,e, comb(odd_num, o) * comb(even_num, e))
                ans += comb(odd_num, o) * comb(even_num, e)
        else:
            if o % 2 == 1:
                ans += comb(odd_num, o) * comb(even_num, e)
print(ans)

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
if list([x for x in A if (x % 2 == 1)]):
    print((2 ** (N - 1)))
else:
    if P == 0:
        print((2**N))
    else:
        print((0))

-import math - -N, P = map(int, input().split()) +N, P = list(map(int, input().split())) -odd = list(filter(lambda x: (x % 2 == 1), A)) -even = list(filter(lambda x: (x % 2 == 0), A)) -# print(odd) -# print(even) -odd_num = len(odd) -even_num = len(even) -ans = 0 - - -def comb(n, r): -    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r)) - - -ans = 0 -for o in range(0, odd_num + 1): -    for e in range(0, even_num + 1): -        # print(o, e) -        if P == 0: -            if o % 2 == 0: -                # print(o,e, comb(odd_num, o) * comb(even_num, e)) -                ans += comb(odd_num, o) * comb(even_num, e) -        else: -            if o % 2 == 1: -                ans += comb(odd_num, o) * comb(even_num, e) -print(ans) +if list([x for x in A if (x % 2 == 1)]): +    print((2 ** (N - 1))) +else: +    if P == 0: +        print((2**N)) +    else: +        print((0))