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

int N, P;
int main() {
  scanf("%d%d", &N, &P);
  bool odd = false;
  for(int i = 0; i < N; ++i) {
    int A; scanf("%d", &A);
    if(A % 2 == 1) odd = true;
  }
  if(P == 1 && !odd) printf("0\n");
  else if(!odd) printf("%lld\n", 1LL << N);
  else printf("%lld\n", 1LL << (N - 1));
  return 0;
}
