#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f3f3f3f3fLL
#define rep(i,a,b) for(register ll i=(a);i<=(b);i++)
#define dep(i,a,b) for(register ll i=(a);i>=(b);i--)
using namespace std;
const int maxn=50+5;
const int maxm=5000+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
const ll mo=1e9+7;
int n,m,k;
int a[maxn];
int ans,tmp,cnt;
ll dp[maxn][2510];
char s[maxn];
ll power(ll a,ll n)
{
    ll sum=1;
    while(n)
    {
        if(n&1) sum=sum*a%mo;
        n>>=1;
        a=a*a%mo;
    }
    return sum;
}
int main()
{
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        int sum=0;
        rep(i,1,n)
        {
            scanf("%d",&a[i]);
            sum+=a[i];
        }
        memset(dp,-1,sizeof(dp));
        dp[0][0]=1;
        rep(i,1,n)
        {
            dep(k,i-1,0)
            dep(j,sum,a[i])
            if(dp[k][j-a[i]]!=-1){
                dp[k+1][j]=max(dp[k+1][j],0);
                dp[k+1][j]+=dp[k][j-a[i]];
                //if(j==18)
                //cout<<k<<" * "<<i<<" "<<dp[k][j-a[i]]<<endl;
            }
        }
        //rep(i,1,n)
        //rep(j,0,sum)
        //cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
        ll ans=0;
        rep(i,1,n)
        if(i*m<=sum&&dp[i][i*m]>0){
            ans+=dp[i][i*m];
            //cout<<i<<" "<<i*m<<" "<<dp[i][i*m]<<endl;
        }
        printf("%lld\n",ans);
    }
    return 0;
}
