import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;
import std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	long n = read.to!long;
	long p = read.to!long;
	long[] as = readln.chomp.split.map!(to!long).array;
	
	long c0 = as.map!(a => a % 2).filter!(x => x == 0).array.length;
	long c1 = as.map!(a => a % 2).filter!(x => x > 0).array.length;
	
	BigInt ans = 1;
	foreach(i; 0 .. c0) ans *= 2;
	if(p == 0){
		if(c1 > 1) foreach(i; 1 .. c1) ans *= 2;
		}
	else{
		if(c1 > 1) foreach(i; 1 .. c1) ans *= 2;
		else ans = 0;
		}
	
	ans.writeln;
	}