let n, p = Scanf.scanf " %d %d" @@ fun a b -> a, b
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let o = Array.fold_left (fun o a -> if a mod 2 = 1 then o + 1 else o) 0 a_s
let e = n - o
let _ = Printf.printf "%d\n" @@
    if o = 0 then if p = 1 then 0 else int_of_float @@ 2. ** float e
    else int_of_float @@ 2. ** float (n - 1)