#AGC017A



def f():

 res=1

 for x in a:

  if x%2==0:

   res*=1

  else:

   res=0

   return res

 return res



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

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



if f()==1 and p==0:

 print(2**n)

elif f()==1 and p==1:

 print(0)

else:

 print(2**(n-1))

def f():

 for x in a:

  if x%2==0:

   continue

  else:

   return False

 return True



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

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



if f()==True and p==0:

 print(2**n)

elif f()==True and p==1:

 print(0)

else:

 print(2**(n-1))

# AGC017A
def f():
    res = 1
    for x in a:
        if x % 2 == 0:
            res *= 1
        else:
            res = 0
            return res
    return res


n, p = list(map(int, input().split()))
a = list(map(int, input().split()))
if f() == 1 and p == 0:
    print(2**n)
elif f() == 1 and p == 1:
    print(0)
else:
    print(2 ** (n - 1))

def f():
    for x in a:
        if x % 2 == 0:
            continue
        else:
            return False
    return True


n, p = list(map(int, input().split()))
a = list(map(int, input().split()))
if f() == True and p == 0:
    print(2**n)
elif f() == True and p == 1:
    print(0)
else:
    print(2 ** (n - 1))

-# AGC017A -    res = 1 -            res *= 1 +            continue -            res = 0 -            return res -    return res +            return False +    return True -if f() == 1 and p == 0: +if f() == True and p == 0: -elif f() == 1 and p == 1: +elif f() == True and p == 1: