#include <iostream>
#define llint long long

using namespace std;

int N, P;
int odd;

int main(void)
{
	cin >> N >> P;
	int a;
	for(int i = 0; i < N; i++){
		cin >> a;
		if(a % 2) odd++;
	}
	
	if(odd == 0){
		if(P == 1) cout << 0 << endl;
		else cout << ((llint)1 << N) << endl;
	}
	else cout << ((llint)1 << (N-1)) << endl;
	return 0;
}