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

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

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

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

-N, P = [int(x) for x in input().split()] -A = [int(x) for x in input().split()] -import collections +import sys -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))) +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()