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

long f(long x) {
  long ret = 1;
  for (long i = 0; i < x; i++) ret *= 2;
  return ret;
}

int main() {
  long N, P;
  cin >> N >> P;
  long a, ne = 0, no = 0;
  for (long i = 0; i < N; i++) {
    cin >> a;
    if (a % 2) no++;
    else ne++;
  }
  if (no == 0) cout << (P ? 0 : f(N)) << endl;
  else cout << f(N-1) << endl;
}