// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long N, P;
    scan(N, P);
    auto A = aryread();
    long[2] cnt;
    foreach (a; A)
        cnt[a & 1]++;
    if (cnt[1] == 0 && P == 1)
    {
        writeln(0);
        return;
    }
    long ans = 2 ^^ cnt[0];
    dprint(cnt, ans);
    long tmp;
    foreach (x; 0 .. N + 1)
    {
        if (cnt[1] < 2 * x + P)
            break;
        tmp += combination(cnt[1], 2 * x + P);
    }
    writeln(ans * tmp);
}

/// Number of k-combinations
T combination(T = long)(T n, T k)
{
    assert(0 <= k);
    assert(0 <= n);
    if (n < k)
        return 0;
    k = min(n - k, k);
    if (k == 0)
        return 1;
    if (k == 1)
        return n;
    return memoize!(combination!T)(n - 1, k - 1) + memoize!(combination!T)(n - 1, k);
}
