#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll f[2];int a[55];
int main (){
	int n,p;
	scanf ("%d%d",&n,&p);
	for (int i=1;i<=n;i++)
	{scanf ("%d",&a[i]);a[i]&=1;}
	f[0]=1ll;
	f[1]=0ll;
	for (int i=1;i<=n;i++)
	{if (a[i]==0) {f[0]*=2ll;f[1]*=2ll;}
	else {ll t1=f[0],t2=f[1];f[0]+=t2;f[1]+=t1;}
	}
	printf ("%lld",f[p]);
	return 0;
}