#include<iostream>
using namespace std;
int n, i, ok, x, p, sol;
int main(){
    cin>> n >> p;
    for(i = 1; i <= n; i++){
        cin>> x;
        ok |= x % 2;
    }
    if(p == 1 && ok == 0){
        cout<< 0;
        return 0;
    }
    n -= ok;
    cout<< (1LL << n);
}
