#include <bits/stdc++.h>
using namespace std;
int n,a,x[55];
long long dp[55][55][2555];
int main()
{
    scanf("%d%d",&n,&a);
    for (int i=1;i<=n;++i) scanf("%d",&x[i]);
    dp[0][0][0]=1;
    for (int i=1;i<=n;++i) {
        for (int j=0;j<=i;++j)
            for (int k=0;k<=2500;++k) {
            dp[i][j][k]+=dp[i-1][j][k];
            dp[i][j+1][k+x[i]]+=dp[i-1][j][k];
        }
    }
    long long res=0;
    for (int i=1;i<=n;++i)
        res+=dp[n][i][i*a];
    cout<<res<<endl;
    return 0;
}
