#include<iostream>
using namespace std;
long long n,a[111],dp[111][2],p;
int main()
{
	cin>>n>>p;
	for (int i=1;i<=n;i++) cin>>a[i];
	dp[0][0]=1;
	for (int i=1;i<=n;i++)
	{
		for (int j=0;j<=1;j++)
		{
			if (a[i]%2)
			{
				dp[i][j]=dp[i-1][1-j]+dp[i-1][j];
			}
			else dp[i][j]=2*dp[i-1][j];
		}
	}
	cout<<dp[n][p]<<endl;
	return 0;
}