#include<stdio.h>
typedef long long ll;
int main()
{
	int num, p;
	scanf("%d%d", &num, &p);
	int c0 = 0, c1 = 0;
	for (int i = 0; i < num; i++)
	{
		int z;
		scanf("%d", &z);
		if (z % 2 == 0)c0++;
		else c1++;
	}
	if (c1 == 0)
	{
		if (p == 0)printf("%lld\n", 1LL << num);
		else printf("0\n");
	}
	else printf("%lld\n", 1LL << (num - 1));
}