#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i=0; i<(n); i++)
using namespace std;

int main() {
  int n, p; cin>>n>>p;
  vector<int> a(n);
  rep(i, n) cin>>a[i];

  int cnt=0;
  rep(i, n) if (a[i]%2==1) cnt++;
  ll ans=powl(2, n-1);
  if (p==0&&cnt==0) ans*=2;
  if (n==1&&cnt!=p) ans=0;
  if (p==1&&cnt==0) ans=0;
  cout<<ans<<endl;
}
