#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

int N, P;
int c[2];

int main() {
	register int i; int x;
	scanf("%d%d", &N, &P);
	for(i = 1; i <= N; ++i)
		scanf("%d", &x), ++c[x & 1];
	printf("%lld\n", c[1] ? 1ll << (N - 1) : P ? 0 : (1ll << N));
	return 0;
}