// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



#define EACH(i,a) for (auto& i : a)

#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)

#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)

#define REP(i,n) FOR(i,0,n)

#define RREP(i,n) RFOR(i,0,n)

#define ALL(a) (a).begin(),(a).end()

#define debug(x) cerr << #x << ":" << x << endl;

#define OK(ok) cout << (ok ? "Yes" : "No") << endl;

typedef long long ll;



void CINT(){}

template <class Head,class... Tail>

void CINT(Head&& head,Tail&&... tail) {

  cin >> head; CINT(move(tail)...);

}

#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)

#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)

#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)



const int INF = 1e9 + 1;

const int MOD = 1e9 + 7;

const int MAX_N = 1e3 + 1;



int N, P;



ll memo[MAX_N][MAX_N];



ll nCr(ll n, ll r)

{

  if (r == 0 || n == r) return 1;

  if (memo[n][r] >= 0) return memo[n][r];

  return memo[n][r] = nCr(n - 1, r - 1) + nCr(n - 1, r);

}



int main()

{

  cin.tie(0);

  ios::sync_with_stdio(false);



  int odd, even;

  odd = even = 0;

  memset(memo, -1, sizeof(memo));

  

  cin >> N >> P;

  REP(i, N) {

    CIN(a);

    if (a & 1) odd++;

    else even++;

  }



  ll ans = 0ll;

  

  REP(i, odd + 1) {

    if (i % 2 == P) {

      ans += nCr(odd, i);

    }

  }

  REP(i, even) {

    ans *= 2;

  }

  cout << ans << endl;



  return 0;

}




// Faster C++ solution for the same problem (measured speedup: 9.15680460621095x):
#include <bits/stdc++.h>

// statics

using namespace std;

using int64 = int_fast64_t;

using PAIR = pair<int64, int64>;

constexpr int INF = 1 << 30;

constexpr int64 LINF = 1LL << 60;

constexpr int MOD = 1e9 + 7;

constexpr int MAX_N = 3e5 + 1;



// init/input

#define int int64

#define INIT ios::sync_with_stdio(false);cin.tie(0);

#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);

template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}

template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}

#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;



// out

#define OUT(dist) cout<<(dist);

#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);

#define SP cout<<" ";

#define BR cout<<endl;

#define zero(n) cout<<setfill('0')<<right<<setw(n)

#define debug(x) cerr<<#x<<":"<< (x);BR;



// utility

#define ALL(a) (a).begin(), (a).end()

#define EACH(i, a) for(auto &&i:(a))

#define FOR(i, a, b) for(int i=(a);i<(b);++i)

#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)

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

#define RREP(i, n) for(int i=(n)-1;i>=0;--i)



int ncr[55][55];



int power(int x, int n) {

	int res = 1LL;

	while (n > 0) {

		if (n & 1) (res *= x);

		(x *= x);

		n >>= 1;

	}

	return res;

}



int f(int n, int r){

	if(r==0 || r==n) return 1;

	if(ncr[n][r]>0) return ncr[n][r];

	return ncr[n][r] = f(n-1, r-1) + f(n-1, r);

}



signed main() {

  INIT;

	VAR(int,n,p);

	VEC(int,a,n);

	int zero, one=0;

	REP(i,n){

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

	}

	zero = n-one;



	int ans=0;

	REP(i,one+1){

		if(p==i%2){

			ans += f(one,i);

		}

	}

	ans *= power(2,zero);

	OUT(ans)BR;

  

  return 0;

}