let n, p = Scanf.scanf " %d %d" @@ fun a b -> a, b
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let e, o = Array.fold_left (fun (e, o) a -> if a mod 2 = 0 then e + 1, o else e, o + 1) (0, 0) a_s
let memo = Array.make_matrix 51 51 @@ -1
let rec comb n k =
  if memo.(n).(k) > -1 then memo.(n).(k)
  else
    (memo.(n).(k) <- if n < k then 0 else if n = k then 1 else if k = 0 then 1
      else comb (n - 1) (k - 1) + comb (n - 1) k;
    memo.(n).(k))
let f n =
  let i = ref n in
  let sum = ref 0 in
  while !i <= o do sum := !sum + comb o !i; i := !i + 2 done;
  !sum
let _ =
  Printf.printf "%d\n" @@ if p = 1 && o = 0 then 0
    else
      let even = int_of_float @@ 2. ** float e in
      even * if p = 1 then f 1 else f 0