#include <bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < n; i++)
#define for1(i, n) for(int i = 1; i <= n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define V vector<int>
#define VP vector<pair<int, int> >
#define FASTIO ios_base::sync_with_stdio(0)
using namespace std;
#ifdef _WIN32
#include <windows.h>
#define print(x) PRINT(x, #x)
template<typename T> inline const void PRINT(T VARIABLE, string NAME)
{
#ifndef ONLINE_JUDGE /// ONLINE_JUDGE IS DEFINED ON CODEFORCES
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole, 10);
    cerr << NAME << " = " << VARIABLE << '\n';
    SetConsoleTextAttribute(hConsole, 7);
#endif
}
#else
#define print(x) 0
#endif
#ifndef ONLINE_JUDGE
#ifdef _WIN32
#define cin fin
#define cout fout
ifstream fin("in.css");
ofstream fout("out.css");
#endif
#endif // ONLINE_JUDGE
struct pair_hash
{
    template<typename T1, typename T2>
    size_t operator () (const pair<T1, T2> &p) const
    {
        auto h1 = hash<T1>{}(p.first);
        auto h2 = hash<T2>{}(p.second);
        return h1 ^ h2;
    }
};
typedef long long ll;
typedef unsigned long long ull;
const ll INFLL = 2 * (ll)1e18 + 100;
const int INFINT = 2 * (int)1e9 + 100;

void die()
{
    cout << "NO";
    exit(0);
}
const int NMAX = 1e3 + 5;
const int MOD = 1e9 + 7; /// careful here (7 or 9, 66.. etc)
const double PI = atan(1) * 4;
const double EPS = 1e-12;

int n, p;
int par, impar, nr;
ull comb[55][55];
bool calculated[55][55];

/*ll comb(int _n, int _k)
{
    int _nk = _n - _k;
    bool vnk[55], vk[55];
    for1(i, 54) vnk[i] = vk[i] = 0;
    ll ret = 1;
    for1(i, _n)
    {
        int temp = i;
        for1(j, i)
        {
            while(temp % j == 0)
            {
                if(vnk[j] == 0 && j <= _nk)
                {
                    vnk[j] = 1;
                    temp /= j;
                    continue;
                }
                else if(vk[j] == 0 && j <= _k)
                {
                    vk[j] = 1;
                    temp /= j;
                    continue;
                }
                break;
            }
        }
        ret *= temp;
        print(temp);
    }
    return ret;
}*/

void get_comb(int _n, int _k)
{
    calculated[_n][_k] = 1;
    if(_n == _k)
    {
       // print(_n); print(_k);
        comb[_n][_k] = 1;
        return;
    }
    if(_k == 1)
    {
        comb[_n][_k] = _n;
        return;
    }
    if(_k == 0)
    {
        comb[_n][_k] = 1;
        return;
    }

    if(!calculated[_n - 1][_k - 1]) get_comb(_n - 1, _k - 1);
    if(!calculated[_n - 1][_k]) get_comb(_n - 1, _k);

    comb[_n][_k] = comb[_n - 1][_k - 1] + comb[_n - 1][_k];
}

int main()
{
    for(int i = 50; i >= 1; i--)
        for(int j = i; j >= 0; j--)
            if(!calculated[i][j])
                get_comb(i, j);
    print(comb[50][25]);
    comb[0][0] = 1;

    cin >> n >> p;
    for1(i, n)
    {
        int a;
        cin >> a;
        if(a % 2) impar++;
        else par++;
    }
    if(!p)
    {
        ull sol = 0, mult = 1;
        for1(i, par) mult *= 2;
        for(int i = 0; i <= impar; i += 2)
        {
            print(comb[impar][i]);
            sol += mult * comb[impar][i];
        }
        cout << sol;
        cerr << mult;
    }
    else
    {
        ull mult = 1;
        for1(i, par) mult *= 2;
        ull sol = 0;
        for(int i = 1; i <= impar; i += 2)
            sol += mult * comb[impar][i];
        cout << sol;
    }

    return 0;
}


Measured memory_bytes: 256