let [|N; P|] = stdin.ReadLine().Split() |> Array.map int

let A = stdin.ReadLine().Split() |> Array.map int
let odd = A |> Array.filter (fun x -> x % 2 = 1) |> Array.length

if odd = 0
then if P = 0 then (int64 1) <<< N else (int64 0)
else (int64 1) <<< (N-1)
|> stdout.WriteLine