#include <bits/stdc++.h>
using namespace std;

int N, P;

int main() {
	cin >> N >> P;
	int cntOdd = 0;
	for (int i = 0; i < N; i++) {
		int x; cin >> x;
		cntOdd += x % 2;
	}

	long long waysOdd = (1LL << (N-cntOdd)) * (cntOdd == 0 ? 0 : 1LL << (cntOdd-1));

	if (P == 1) {
		cout << waysOdd << endl;
	} else {
		cout << (1LL << N) - waysOdd << endl;
	}

	return 0;
}
