#include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	long long n,p,c=0,a,ans;
	cin>>n>>p;
	rep(i,n){
		cin>>a;
		c=(c||((a%2)?1:0));
	}
	if(c==0)ans=(p==0)?pow(2,n):0;
	else ans=pow(2,n-1);
	cout<<ans<<endl;
	return 0;	
}