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



count = {0: 0, 1: 0}

for a in input().split():

    count[int(a) % 2] += 1



if count[1] == 0:

    if p == 0:

        print((pow(2, n)))

    else:

        print((0))

else:

    print((pow(2, n - 1)))
import math

 

 

def comb(n, r):

    return math.factorial(n) / math.factorial(r) / math.factorial(n - r)

 

 

def main():

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

    a = tuple([int(x) % 2 for x in input().split()])

 

    if n == 1 and a[0] % 2 != p:

        print((0))

        return 0

 

    t = len(tuple([x for x in a if x == 1]))

    f = n - t

 

    f_comb = 0

    for j in range(f + 1):

        f_comb += comb(f, j)

 

    t_comb = 0

    if p == 0:

        for i in range(t + 1):

            if i % 2 == 0:

                t_comb += comb(t, i)

    else:

        for i in range(t + 1):

            if i % 2 == 1:

                t_comb += comb(t, i)

 

    print((int(t_comb * f_comb)))

 

    return 0

 

 

if __name__ == '__main__':

    main()
n, p = list(map(int, input().split()))
count = {0: 0, 1: 0}
for a in input().split():
    count[int(a) % 2] += 1
if count[1] == 0:
    if p == 0:
        print((pow(2, n)))
    else:
        print((0))
else:
    print((pow(2, n - 1)))

import math


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


def main():
    n, p = list(map(int, input().split()))
    a = tuple([int(x) % 2 for x in input().split()])
    if n == 1 and a[0] % 2 != p:
        print((0))
        return 0
    t = len(tuple([x for x in a if x == 1]))
    f = n - t
    f_comb = 0
    for j in range(f + 1):
        f_comb += comb(f, j)
    t_comb = 0
    if p == 0:
        for i in range(t + 1):
            if i % 2 == 0:
                t_comb += comb(t, i)
    else:
        for i in range(t + 1):
            if i % 2 == 1:
                t_comb += comb(t, i)
    print((int(t_comb * f_comb)))
    return 0


if __name__ == "__main__":
    main()

-n, p = list(map(int, input().split())) -count = {0: 0, 1: 0} -for a in input().split(): -    count[int(a) % 2] += 1 -if count[1] == 0: +import math + + +def comb(n, r): +    return math.factorial(n) / math.factorial(r) / math.factorial(n - r) + + +def main(): +    n, p = list(map(int, input().split())) +    a = tuple([int(x) % 2 for x in input().split()]) +    if n == 1 and a[0] % 2 != p: +        print((0)) +        return 0 +    t = len(tuple([x for x in a if x == 1])) +    f = n - t +    f_comb = 0 +    for j in range(f + 1): +        f_comb += comb(f, j) +    t_comb = 0 -        print((pow(2, n))) +        for i in range(t + 1): +            if i % 2 == 0: +                t_comb += comb(t, i) -        print((0)) -else: -    print((pow(2, n - 1))) +        for i in range(t + 1): +            if i % 2 == 1: +                t_comb += comb(t, i) +    print((int(t_comb * f_comb))) +    return 0 + + +if __name__ == "__main__": +    main()