# A - Biscuits

import numpy as np



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

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

odd = len([i for i in A if i%2!=0])

if odd==0 and P==0:

    ans = 2**N

elif odd==0 and P==1:

    ans = 0

else:

    ans = 2**(N-1)

print(ans)
import sys

from sys import exit

from collections import deque

from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)

from heapq import heapify, heappop, heappush

from math import *



sys.setrecursionlimit(10**6)

INF = 10**20

eps = 1.0e-20

MOD = 10**9+7



def lcm(x,y):

    return x*y//gcd(x,y)

def mint():

    return map(int,input().split())

def lint():

    return list(map(int,input().split()))

def ilint():

    return int(input()), list(map(int,input().split()))

def judge(x, l=['Yes', 'No']):

    print(l[0] if x else l[1])

def lprint(l, sep='\n'):

    for x in l:

        print(x, end=sep)

def ston(c, c0='a'):

    return ord(c)-ord(c0)

def ntos(x, c0='a'):

    return chr(x+ord(c0))



N,P = mint()

A = lint()

even = len([a for a in A if a%2==0])

odd = N-even

if odd==0:

    print(0 if P else 2**N)

else:

    print(2**(N-1))

# A - Biscuits
import numpy as np

N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
odd = len([i for i in A if i % 2 != 0])
if odd == 0 and P == 0:
    ans = 2**N
elif odd == 0 and P == 1:
    ans = 0
else:
    ans = 2 ** (N - 1)
print(ans)

import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right  # func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9 + 7


def lcm(x, y):
    return x * y // gcd(x, y)


def mint():
    return map(int, input().split())


def lint():
    return list(map(int, input().split()))


def ilint():
    return int(input()), list(map(int, input().split()))


def judge(x, l=["Yes", "No"]):
    print(l[0] if x else l[1])


def lprint(l, sep="\n"):
    for x in l:
        print(x, end=sep)


def ston(c, c0="a"):
    return ord(c) - ord(c0)


def ntos(x, c0="a"):
    return chr(x + ord(c0))


N, P = mint()
A = lint()
even = len([a for a in A if a % 2 == 0])
odd = N - even
if odd == 0:
    print(0 if P else 2**N)
else:
    print(2 ** (N - 1))

-# A - Biscuits -import numpy as np +import sys +from sys import exit +from collections import deque +from bisect import bisect_left, bisect_right, insort_left, insort_right  # func(リスト,値) +from heapq import heapify, heappop, heappush +from math import * -N, P = list(map(int, input().split())) -A = list(map(int, input().split())) -odd = len([i for i in A if i % 2 != 0]) -if odd == 0 and P == 0: -    ans = 2**N -elif odd == 0 and P == 1: -    ans = 0 +sys.setrecursionlimit(10**6) +INF = 10**20 +eps = 1.0e-20 +MOD = 10**9 + 7 + + +def lcm(x, y): +    return x * y // gcd(x, y) + + +def mint(): +    return map(int, input().split()) + + +def lint(): +    return list(map(int, input().split())) + + +def ilint(): +    return int(input()), list(map(int, input().split())) + + +def judge(x, l=["Yes", "No"]): +    print(l[0] if x else l[1]) + + +def lprint(l, sep="\n"): +    for x in l: +        print(x, end=sep) + + +def ston(c, c0="a"): +    return ord(c) - ord(c0) + + +def ntos(x, c0="a"): +    return chr(x + ord(c0)) + + +N, P = mint() +A = lint() +even = len([a for a in A if a % 2 == 0]) +odd = N - even +if odd == 0: +    print(0 if P else 2**N) -    ans = 2 ** (N - 1) -print(ans) +    print(2 ** (N - 1))