import std;
import core.bitop;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "index", long, "num");
alias PQueue(T, alias less = "a>b") = BinaryHeap!(Array!T, less);

void main()
{
    long n, p;
    scan(n, p);
    auto a = aryread.map!(x => x % 2);
    auto cntOne = a.sum();
    auto comb = new long[][](n, n + 1);
    foreach (i; iota(n))
        comb[i][0] = 1;
    comb[0][1] = 1;
    foreach (i; iota(1, n))
    {
        foreach (j; iota(n).map!"a+=1"())
        {
            comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1];
        }
    }
    writeln(2L ^^ (n - cntOne) * (cntOne > 0 ? iota(cntOne + 1).filter!(x => x % 2 == p)
            .map!(x => comb[cntOne - 1][x])
            .sum() : 0));
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}
