#include <stdio.h>
long long dp[51][2];
int a[51];
int main()
{
	int n,p;
	scanf("%d%d",&n,&p);
	dp[0][0]=1;
	for (int i=1;i<=n;++i)
		scanf("%d",a+i);
	for (int i=1;i<=n;++i)
		for (int j=0;j<2;++j)
			dp[i][j]=dp[i-1][j]+dp[i-1][j^(a[i]&1)];
	printf("%lld",dp[n][p]);
	return 0;
}
