import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val n, p = sc.nextInt()
    val as = Array.fill(n)(sc.nextInt())

    val ans =
      if (as.forall(_ % 2 == 0)) {
        p match {
          case 1 => 0L
          case 0 => math.pow(2L, n.toLong)
        }
      } else {
        math.pow(2L, n - 1)
      }

    println(ans.toLong)
  }

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}
