#include <bits/stdc++.h>

using namespace std;

const int N = 60;

int n, p;
long long dp[N][2];

int main() {
  scanf("%d %d", &n, &p);
  dp[0][0] = 1, dp[0][1] = 0;
  for (int i = 1; i <= n; i++) {
    int u;
    scanf("%d", &u);
    dp[i][0] = dp[i - 1][0] + dp[i - 1][u % 2];
    dp[i][1] = dp[i - 1][1] + dp[i - 1][(u % 2) ^ 1];
  }
  cout << dp[n][p];
  return 0;
}
