// -*- coding:utf-8-unix -*-
use std::cmp;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::LinkedList;
use std::collections::VecDeque;
use std::fs::File;
use std::io;
use std::io::prelude::*;

const INF: i64 = 1223372036854775807;

macro_rules! input {
    (source = s:expr, $(r:tt)*) => {
        let mut iter = s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $(r)*}
    };
    ($(r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $(r)*}
    };
}

macro_rules! input_inner {
    (next:expr) => {};
    (next:expr, ) => {};

    (next:expr, var:ident : t:tt $(r:tt)*) => {
        let var = read_value!(next, t);
        input_inner!{next $(r)*}
    };
}

macro_rules! read_value {
    (next:expr, ( $(t:tt),* )) => {
        ( $(read_value!(next, t)),* )
    };

    (next:expr, [ t:tt ; len:expr ]) => {
        (0..len).map(|_| read_value!(next, t)).collect::<Vec<_>>()
    };

    (next:expr, chars) => {
        read_value!(next, String).chars().collect::<Vec<char>>()
    };

    (next:expr, usize1) => {
        read_value!(next, usize) - 1
    };

    (next:expr, t:ty) => {
        next().parse::<t>().expect("Parse error")
    };
}

use std::cmp::*;
use std::collections::*;
use std::io::stdin;
use std::io::stdout;
use std::io::Write;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

/// Equivalent to std::lowerbound and std::upperbound in c++

fn solve() {
        let (n, p) = {
            let s = {
                let mut s = String::new(); // バッファを確保
                std::io::stdin().read_line(&mut s).unwrap(); // 一行読む。失敗を無視
                s.trim_right().to_owned() // 改行コードが末尾にくっついてくるので削る
            };
            
            let mut ws = s.split_whitespace(); // 空白区切りの単語に分解する
            let n: i32 = ws.next().unwrap().parse().unwrap(); // イテレータから値を取り出して整数に
            let m: i32 = ws.next().unwrap().parse().unwrap();
            (n, m)
        };
        let vec:Vec<i64> = read_vec();
        let mut dp :Vec<Vec<i64>> = vec![vec![0;(n+1)as usize];2];
        dp[0][0] = 1;
        for i in 0..(n) as usize {
            dp[0][i+1] += dp[0][i];
            dp[1][i+1] += dp[1][i];
            if vec[i]%2 == 1{
                dp[0][i+1] += dp[1][i];
                dp[1][i+1] += dp[0][i];
            }
            else {
                dp[0][i+1] += dp[0][i];
                dp[1][i+1] += dp[1][i];
            }
        }
        println!("{:?}", dp[p as usize][n as usize]);

    }
fn main() {
    solve()
}


Measured memory_bytes: 2116