

object prog extends App {
  val sc = new java.util.Scanner(System.in)
  val n, p = sc.nextInt
  val ax = Array.fill(n)(sc.nextInt)
    
  def factUntil(n: BigInt, end: BigInt): BigInt = {
    if (n == end) 1
    else n * factUntil(n-1, end)
  }
    
  def comb(a: Long, b: Long): Long = {
    (factUntil(a, b) / factUntil(a-b, 0)).toLong
  }
    
  val ax01 = ax.map(_ % 2)
  val cnt0 = ax01.filter(_ == 0).size
  val cnt1 = ax01.size - cnt0
    
  val even = Math.pow(2, cnt0).toLong
    
  var ans: Long = 0
  for (i <- 0 to cnt1 if i % 2 == p) {
      
    ans += even * comb(cnt1, i)
  }

  println(ans)
}