// Original C++ solution (slower):
#include<bits/stdc++.h>

#define MOD LLONG_MAX

#define INF 0x3f3f3f3f

#define INFL 0x3f3f3f3f3f3f3f3f

#define EPS (1e-10)

#define rep(i,n)for(int i=0;i<(n);i++)

using namespace std;

typedef pair<int, int>P;

typedef long long Int;

const Int B = 10000;

const int BW = 4;         // log B

const int MAXDIGIT = 120; // it can represent 4*MAXDIGIT digits (in base 10)

struct BigNum;

BigNum convert(Int);

BigNum convert(const string&);

BigNum operator+=(BigNum&, BigNum);

struct BigNum {

	Int digit[MAXDIGIT];      // base (power of 10)

	int size;

	BigNum() {

		memset(digit, 0, sizeof(digit));

		digit[0] = 0;

	}

	BigNum(int size, Int a) : size(size) {

		memset(digit, 0, sizeof(digit));

		digit[0] = a;

	}

	BigNum(Int a) {

		*this = convert(a);

	}

	BigNum&operator=(Int a) {

		return *this = convert(a);

	}

	BigNum(string&s) {

		*this = convert(s);

	}

	BigNum&operator=(string&s) {

		return *this = convert(s);

	}

	BigNum operator++() {

		*this += 1;

		return *this;

	}

	BigNum operator++(int) {

		auto t = *this;

		*this += 1;

		return *this;

	}

};

const BigNum ZERO(1, 0), ONE(1, 1);



// Comparators

bool operator<(BigNum x, BigNum y) {

	if (x.size != y.size) return x.size < y.size;

	for (int i = x.size - 1; i >= 0; --i)

		if (x.digit[i] != y.digit[i]) return x.digit[i] < y.digit[i];

	return false;

}

bool operator >(BigNum x, BigNum y) { return y < x; }

bool operator<=(BigNum x, BigNum y) { return !(y < x); }

bool operator>=(BigNum x, BigNum y) { return !(x < y); }

bool operator!=(BigNum x, BigNum y) { return x < y || y < x; }

bool operator==(BigNum x, BigNum y) { return !(x < y) && !(y < x); }



// Utilities

BigNum normal(BigNum x) {

	Int c = 0;

	for (int i = 0; i < x.size; ++i) {

		while (x.digit[i] < 0)

			x.digit[i + 1] -= 1, x.digit[i] += B;

		Int a = x.digit[i] + c;

		x.digit[i] = a % B;

		c = a / B;

	}

	for (; c > 0; c /= B) x.digit[x.size++] = c % B;

	while (x.size > 1 && x.digit[x.size - 1] == 0) --x.size;

	return x;

}

BigNum convert(Int a) {

	return normal(BigNum(1, a));

}

BigNum convert(const string &s) {

	BigNum x(1, 0);

	int i = s.size() % BW;

	if (i > 0) i -= BW;

	for (; i < (int)s.size(); i += BW) {

		Int a = 0;

		for (int j = 0; j < BW; ++j)

			a = 10 * a + (i + j >= 0 ? s[i + j] - '0' : 0);

		x.digit[x.size++] = a;

	}

	reverse(x.digit, x.digit + x.size);

	return normal(x);

}

// Input/Output

ostream &operator<<(ostream &os, BigNum x) {

	os << x.digit[x.size - 1];

	for (int i = x.size - 2; i >= 0; --i)

		os << setw(BW) << setfill('0') << x.digit[i];

	return os;

}

istream &operator>>(istream &is, BigNum &x) {

	string s; is >> s;

	x = convert(s);

	return is;

}



// Basic Operations 

BigNum operator+(BigNum x, BigNum y) {

	if (x.size < y.size) x.size = y.size;

	for (int i = 0; i < y.size; ++i)

		x.digit[i] += y.digit[i];

	return normal(x);

}

BigNum operator+=(BigNum&x, BigNum y) {

	return x = x + y;

}

BigNum operator-(BigNum x, BigNum y) {

	assert(x >= y);

	for (int i = 0; i < y.size; ++i)

		x.digit[i] -= y.digit[i];

	return normal(x);

}

BigNum operator-=(BigNum&x, BigNum y) {

	return x = x - y;

}

BigNum operator*(BigNum x, BigNum y) {

	BigNum z(x.size + y.size, 0);

	for (int i = 0; i < x.size; ++i)

		for (int j = 0; j < y.size; ++j)

			z.digit[i + j] += x.digit[i] * y.digit[j];

	return normal(z);

}

BigNum operator*=(BigNum&x, BigNum y) {

	return x = x*y;

}

BigNum operator*(BigNum x, Int a) {

	for (int i = 0; i < x.size; ++i)

		x.digit[i] *= a;

	return normal(x);

}

BigNum operator*=(BigNum&x, Int a) {

	return x = x*a;

}

pair<BigNum, Int> divmod(BigNum x, Int a) {

	Int c = 0, t;

	for (int i = x.size - 1; i >= 0; --i) {

		t = B * c + x.digit[i];

		x.digit[i] = t / a;

		c = t % a;

	}

	return pair<BigNum, Int>(normal(x), c);

}

BigNum operator/(BigNum x, Int a) {

	return divmod(x, a).first;

}

BigNum operator/=(BigNum&x, Int a) {

	return x = x / a;

}

Int operator%(BigNum x, Int a) {

	return divmod(x, a).second;

}

BigNum operator%=(BigNum&x, Int a) {

	return x = x%a;

}

pair<BigNum, BigNum> divmod(BigNum x, BigNum y) {

	if (x.size < y.size) return pair<BigNum, BigNum>(ZERO, x);

	int F = B / (y.digit[y.size - 1] + 1); // multiplying good-factor

	x = x * F; y = y * F;

	BigNum z(x.size - y.size + 1, 0);

	for (int k = z.size - 1, i = x.size - 1; k >= 0; --k, --i) {

		z.digit[k] = (i + 1 < x.size ? x.digit[i + 1] : 0) * B + x.digit[i];

		z.digit[k] /= y.digit[y.size - 1];

		BigNum t(k + y.size, 0);

		for (int m = 0; m < y.size; ++m)

			t.digit[k + m] = z.digit[k] * y.digit[m];

		t = normal(t);

		while (x < t) {

			z.digit[k] -= 1;

			for (int m = 0; m < y.size; ++m)

				t.digit[k + m] -= y.digit[m];

			t = normal(t);

		}

		x = x - t;

	}

	return pair<BigNum, BigNum>(normal(z), x / F);

}

BigNum operator/(BigNum x, BigNum y) {

	return divmod(x, y).first;

}

BigNum operator/=(BigNum&x, BigNum y) {

	return x = x / y;

}

BigNum operator%(BigNum x, BigNum y) {

	return divmod(x, y).second;

}

BigNum operator%=(BigNum&x, BigNum y) {

	return x = x%y;

}

// Advanced Operations

BigNum shift(BigNum x, int k) {

	if (x.size == 1 && x.digit[0] == 0) return x;

	x.size += k;

	for (int i = x.size - 1; i >= k; --i) x.digit[i] = x.digit[i - k];

	for (int i = k - 1; i >= 0; --i) x.digit[i] = 0;

	return x;

}

BigNum sqrt(BigNum x) { // verified UVA 10023

	const BigNum _20 = convert(2 * B);

	BigNum odd = ZERO;

	BigNum rem(2, 0);

	BigNum ans = ZERO;

	for (int i = 2 * ((x.size - 1) / 2); i >= 0; i -= 2) {

		int group = (i + 1 < x.size ? x.digit[i + 1] : 0) * B + x.digit[i];

		odd = _20 * ans + ONE;

		rem = shift(rem, 2) + convert(group);

		int count = 0;

		while (rem >= odd) {

			count = count + 1;

			rem = rem - odd;

			odd.digit[0] += 2;

			odd = normal(odd);

		}

		ans = shift(ans, 1) + convert(count);

	}

	return ans;

}

typedef BigNum ll;

int a[50];

ll ppow(ll a, ll b) {

	ll res = 1;

	while (b > 0) {

		if (b % 2 == 1)res = (res*a) % MOD;

		a = (a*a) % MOD;

		b /= 2;

	}

	return res;

}

BigNum fact[51];

int main() {

	int n, p; scanf("%d%d", &n, &p);

	rep(i, n)scanf("%d", &a[i]);

	fact[0] = 1;

	for (int i = 1; i < 51; i++)fact[i] = (fact[i - 1] * i);

	int cnt = 0;

	rep(i, n) {

		if (a[i] % 2 == 1)cnt++;

	}

	BigNum ans = 0;

	for (int i = 0; i <= cnt; i += 2) {

		ans += (fact[cnt] / fact[i] / fact[cnt - i])*ppow(2, n - cnt);

	}

	if (p == 0)cout << ans << endl;

	else cout << ppow(2, n) - ans << endl;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

#define rep(i,n)for(int i=0;i<(n);i++)

using namespace std;

typedef long long ll;



int a[50];

ll dp[51][2];

int main() {

	int n, p; scanf("%d%d", &n, &p);

	rep(i, n)scanf("%d", &a[i]), a[i] %= 2;

	dp[0][0] = 1;

	rep(i, n)rep(j, 2) {

		dp[i + 1][j] += dp[i][j];

		dp[i + 1][j^a[i]] += dp[i][j];

	}

	printf("%lld\n", dp[n][p]);

}

// Fastest known solution for this problem: