import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val p = sc.nextInt()
    var odd = 0
    var even = 0

    for (i in 0 until n) {
        val a = sc.nextInt()
        odd += a % 2
        even += (a % 2) xor 1
    }
    if (odd == 0) {
        println(pow(2, even) * int(p == 0))
    } else {
        println(pow(2, odd - 1) * pow(2, even))
    }
}

fun pow(a: Int, b: Int): Long {
    var result = 1L
    for (i in 0 until b) {
        result *= a
    }
    return result
}

fun int(ok: Boolean): Int {
    if (ok) {
        return 1
    }
    return 0
}
