import java.math.BigInteger
import java.util.*

/**
 * Created by zzt on 17-7-11.
 */

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val p = scanner.nextInt()
    var hasOdd = false

    for (i in 1..n) {
        if (scanner.nextInt() % 2 != 0) {
            hasOdd = true
            break
        }
    }


    println(if (hasOdd) BigInteger("2").pow(n-1).toString() else if (p==0) BigInteger("2").pow(n).toString() else 0)
}