open Scanf
open Printf
open Str
open Num

let read_list f =
  split (regexp " +") (read_line ()) |> List.map f

let rec comb n m =
  if n < m then num_of_int 0 else
    if m = 0 || n = m then num_of_int 1 else
      comb (n-1) (m-1) */ (num_of_int n) // (num_of_int m)
      
let () =
  let n, p = sscanf (read_line ()) "%d %d" (fun x y -> (x, y)) in
  let e = List.length (List.filter (fun x -> x mod 2 = 0) (read_list int_of_string)) in
  let o = n - e in
  let rec eloop x c =
    if x > e then c else eloop (x+1) (c +/ comb e x) in
  let en = eloop 0 (num_of_int 0) in
  let rec oloop x c =
    if x > o then c else oloop (x+2) (c +/ comb o x) in
  let on = if p = 0 then oloop 0 (num_of_int 0) else oloop 1 (num_of_int 0) in
  en */ on |> string_of_num |> print_endline
