#include <iostream>

using namespace std;

int main(void)
{
	int N, P, A,c[2] = {0,0};
	cin >> N >> P;
	unsigned long long int ans = 1;

	for (int i = 0; i < N; i++) {
		cin >> A;
		c[A % 2]++;
	}
	if (c[0] == N) {
		if (P == 1) {
			ans = 0;
		} else {
			ans = 2;
		}
	}

	for (int i = 1; i <= N - 1; i++) {
		ans *= 2;
	}
	cout << ans << endl;
	
	return 0;
}