#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
int n,p,a[60],s;
LL f[5005];
int main(){
	scanf("%d%d",&n,&p);
	f[0]=1;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);s+=a[i];
		for(int j=s;j>=a[i];j--)f[j]+=f[j-a[i]];
	}
	LL ans=0;
	for(int j=p;j<=s;j+=2)ans+=f[j];
	printf("%lld",ans);
	return 0;
}