import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(n, p) = in.readLine().split("\\s+").map(_.toInt)
    val as = in.readLine().split("\\s+").map(_.toInt)

    val oddCount = as.count(_ % 2 != 0)

    out.println(
      if (oddCount == 0) {
        if (p == 0) {
          Math.pow(2, n).toLong
        } else {
          0
        }
      } else {
        Math.pow(2, n - 1).toLong
      }
    )
    out.flush()
  }
}
