stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

 

int x[60];;

long long dp[60][60][2600];

int main()

{

    int n, a;

    scanf("%d%d", &n, &a);

    for(int i = 1; i <= n; ++i)

        scanf("%d", &x[i]);

    for(int i = 0; i <= n; ++i)

        dp[i][0][0] = 1;

    for(int i = 1; i <= n; ++i)

    {

        for(int j = 1; j <= i; ++j)

        {

            for(int k = 0; k <= 2500; ++k)

            {

                if(k - x[i] >= 0)

                    dp[i][j][k] += dp[i - 1][j - 1][k - x[i]];

                dp[i][j][k] += dp[i - 1][j][k];

            }

        }

    }

    long long ans = 0;

    for(int i = 1; i <= n; ++i)

        ans += dp[n][i][a * i];

    printf("%lld\n", ans);

    return 0;

}

/*

3 8

8 8 9

 

4 8

7 9 8 9

 

8 5

3 6 2 8 7 6 5 9

 

33 3

3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

 

*/

// Faster C++ solution for the same problem (measured speedup: 13.41794297028313x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

	scanf("%d %d",&n,&A);

	for(int i=1;i<=n;i++)

		scanf("%d",&a[i]);

	dp[0][0]=1LL;

	for(int i=1;i<=n;i++)

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

	for(int tot=1;tot<=n;tot++)

		ans+=dp[tot][A*tot];

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define LL long long

#define ULL unsigned long long

#define INF 0x3f3f3f3f

using namespace std;

 

template<class T> inline

void read(T& x) {

	int f = 1; x = 0;

	char ch = getchar();

	while (ch < '0' || ch > '9')   {if (ch == '-') f = -1; ch = getchar();}

	while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}

	x *= f;

}

 

/*============ Header Template ============*/



const int N = 50 + 5;

const int M = 2500 + 5;



int n, A;

int a[N];

LL f[M][N];



int main() {

	read(n), read(A);

	for (int i = 1; i <= n; i++) read(a[i]);

	f[0][0] = 1;

	for (int i = 1; i <= n; i++) {

		for (int j = 2500; j >= a[i]; j--)

			for (int k = 1; k <= i; k++) f[j][k] += f[j - a[i]][k - 1];

	}

	LL ans = 0;

	for (int i = 1; i <= n; i++) 

		if (i * A <= 2500) ans += f[i * A][i];

	printf("%lld\n", ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 7.123242249902721x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

	scanf("%d %d",&n,&A);

	for(int i=1;i<=n;i++)

		scanf("%d",&a[i]);

	dp[0][0]=1LL;

	for(int i=1;i<=n;i++)

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

	for(int tot=1;tot<=n;tot++)

		ans+=dp[tot][A*tot];

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



long long F[60][2601],n,K,a[210];

long long ans,tmp[60][2601];

int main()

{

	scanf("%lld%lld",&n,&K);

	for(int i=1;i<=n;i++) scanf("%lld",&a[i]); F[0][0]=1;

	for(int i=1;i<=n;i++)

	{

		memset(tmp,0,sizeof tmp);

		for(int j=0;j<i;j++)

			for(int k=0;k<=2501;k++)

			{		

				tmp[j+1][k+a[i]]+=F[j][k];

				tmp[j][k]+=F[j][k];

			}

		for(int j=0;j<=i;j++)

			for(int k=0;k<=2501;k++) 

				F[j][k]=tmp[j][k];

	}

	for(int i=1;i<=n;i++) if(i*K<=2500) ans+=F[i][i*K];

	cout << ans << endl; return 0;

}

// Faster C++ solution for the same problem (measured speedup: 23.60905411764236x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

	scanf("%d %d",&n,&A);

	for(int i=1;i<=n;i++)

		scanf("%d",&a[i]);

	dp[0][0]=1LL;

	for(int i=1;i<=n;i++)

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

	for(int tot=1;tot<=n;tot++)

		ans+=dp[tot][A*tot];

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include <cstdio>

const int MAXN = 51;

const int ZERO = 2550;

const int MAXM = ZERO * 2;

typedef long long LL;

LL F[2][MAXM];

int main() {

	int n, a, i, j, x;

	scanf ( "%d%d", &n, &a );

	F[0][ZERO] = 1;

	for ( i = 1; i <= n; ++i ) {

		scanf ( "%d", &x );

		x -= a;

		for ( j = MAXN; j + MAXN < MAXM; ++j )

			F[i & 1][j] = F[ ( i - 1 ) & 1][j] + F[ ( i - 1 ) & 1][j - x];

	}

	printf ( "%lld\n", F[n & 1][ZERO] - 1 );

}


// Faster C++ solution for the same problem (measured speedup: 1.2457977688622768x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

	scanf("%d %d",&n,&A);

	for(int i=1;i<=n;i++)

		scanf("%d",&a[i]);

	dp[0][0]=1LL;

	for(int i=1;i<=n;i++)

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

	for(int tot=1;tot<=n;tot++)

		ans+=dp[tot][A*tot];

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define sz(x) ((int)(x).size())

#define rep(i,a,b) for (int i=(a); i<(b); i++)

#define per(i,a,b) for (int i=(b-1); i>=(a); i--)

#define debug(x) cout << #x << " => " << x << endl

using namespace std;



#define fi first

#define se second

#define mp make_pair

typedef pair<int,int> pii;



#define pb push_back

typedef vector<int> vi;



typedef long long ll;

typedef long double ld;



const int MAX_N = 7 + 50;

///----------------------------------------------

int dig[MAX_N];

int sum[MAX_N];

ll  f[MAX_N][MAX_N][MAX_N*MAX_N];

int main() {



	///read

	int n, A; cin>>n>>A;

	rep(i,1,n+1) scanf("%d",&dig[i]);

	rep(i,1,n+1) sum[i] = sum[i-1] + dig[i];

	

	///work

	rep(i,0,n+1) f[i][0][0]=1;

	rep(i,1,n+1) rep(j,1,i+1) rep(k,0,sum[i]+1) {

		f[i][j][k] = f[i-1][j][k];

		if (k>=dig[i])

			f[i][j][k] += f[i-1][j-1][k-dig[i]];

	}

	///debug(233);

	///print

	ll ans=0;

	rep(i,1,n+1) if (i*A<=sum[n]) ans+=f[n][i][i*A];

	cout << ans;



}

// Faster C++ solution for the same problem (measured speedup: 4.861068000830154x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

	scanf("%d %d",&n,&A);

	for(int i=1;i<=n;i++)

		scanf("%d",&a[i]);

	dp[0][0]=1LL;

	for(int i=1;i<=n;i++)

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

	for(int tot=1;tot<=n;tot++)

		ans+=dp[tot][A*tot];

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

const int INF = 1e9;

const ll LINF = 1e18;



/*

<url:https://arc060.contest.atcoder.jp/tasks/arc060_a>

問題文============================================================

 高橋君は、N 枚のカードを持っています。 i (1≤i≤N) 番目のカードには、整数 xi が書かれています。

 高橋君は、これらのカードの中から 1 枚以上を選び、

 選んだカードに書かれた整数の平均をちょうど A にしたいと考えています。

 そのようなカードの選び方が何通りあるか求めてください。

=================================================================



解説=============================================================



================================================================

*/

ll dp[55][55][50*50+1];

int main(void) {

	cin.tie(0); ios::sync_with_stdio(false);

    ll N,A; cin >>N >> A;

    vector<ll> x(N);

    for(auto& in:x) cin >> in;

    dp[0][0][0] = 1;

    for(int i = 0; i < N;i++){

        for(int j = 0; j <= i; j++){

            for(int k = 0; k <= N*50; k++){

                if(dp[i][j][k] == 0) continue;

                dp[i+1][j][k] += dp[i][j][k];

                dp[i+1][j+1][k+x[i]] += dp[i][j][k];

            }

        }

    }

    ll ans = 0;

    for(int i = 1; i <= N;i++){

        ans += dp[N][i][i*A];

    }

    cout << ans << endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 8.084768372702555x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

	scanf("%d %d",&n,&A);

	for(int i=1;i<=n;i++)

		scanf("%d",&a[i]);

	dp[0][0]=1LL;

	for(int i=1;i<=n;i++)

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

	for(int tot=1;tot<=n;tot++)

		ans+=dp[tot][A*tot];

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cstring>

#include <algorithm>

#include <utility>

using namespace std;

//#define local

const int maxn=55;

long long dp[maxn][maxn*maxn];

int main()

{

#ifdef local

    freopen("input.txt","r",stdin);

    //freopen("output.txt","w",stdout);

#endif

    int n,a,x,maxx=0;

    long long ans=0;

    cin>>n>>a;

    dp[0][0]=1;

    for(int i=1; i<=n; i++)

    {

        cin>>x;

        maxx=max(maxx,x);

        for(int j=i-1; j>=0; j--)

            for(int k=0; k<=j*maxx; k++)

                dp[j+1][k+x]+=dp[j][k];

    }

    for(int i=1; i<=n ;i++)

        ans+=dp[i][i*a];

    cout<<ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.57992516770709x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#define MAXN 50

using namespace std;

typedef long long LL;

int a[MAXN+5];

LL dp[MAXN+5][MAXN*MAXN+5];

int main()

{

	int n,A;

	scanf("%d %d",&n,&A);

	for(int i=1;i<=n;i++)

		scanf("%d",&a[i]);

	dp[0][0]=1LL;

	for(int i=1;i<=n;i++)

		for(int j=A*n;j>=a[i];j--)

			for(int tot=n;tot>=1;tot--)

				dp[tot][j]+=dp[tot-1][j-a[i]];

	LL ans=0;

	for(int tot=1;tot<=n;tot++)

		ans+=dp[tot][A*tot];

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



long long F[60][2601],n,K,a[210];

long long ans,tmp[60][2601];

int main()

{

	scanf("%lld%lld",&n,&K);

	for(int i=1;i<=n;i++) scanf("%lld",&a[i]); F[0][0]=1;

	for(int i=1;i<=n;i++)

	{

		memset(tmp,0,sizeof tmp);

		for(int j=0;j<i;j++)

			for(int k=0;k<=2501;k++)

			{		

				tmp[j+1][k+a[i]]+=F[j][k];

				tmp[j][k]+=F[j][k];

			}

		for(int j=0;j<=i;j++)

			for(int k=0;k<=2501;k++) 

				F[j][k]=tmp[j][k];

	}

	for(int i=1;i<=n;i++) if(i*K<=2500) ans+=F[i][i*K];

	cout << ans << endl; return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.09187595227793x):
#include <bits/stdc++.h>

#define int long long

#define MAXN 52

#define MOD 1000000007

#define sz(a) static_cast<long long>(a.size())

#define INF 2000000000000000000

#define pb push_back

#define mp make_pair

using namespace std;

typedef pair<int,int> pp;

int n,a[MAXN],dp[MAXN][MAXN*MAXN],ans=0,val;

main(){

	//ios::sync_with_stdio(false); cin.tie(0);

	//freopen("inp.txt","r",stdin); //freopen("out.txt","w",stdout);

	//freopen(".INP","r",stdin); freopen(".OUT","w",stdout);

	cin>>n>>val; int i,j,k;

	for (i=1;i<=n;i++) cin>>a[i];

	for (i=0;i<MAXN;i++){

		for (j=0;j<MAXN*MAXN;j++) dp[i][j]=0;

	}

	dp[0][0]=1;

	for (i=1;i<=n;i++){

		for (j=i-1;j>=0;j--){

			for (k=2500;k>=0;k--){

				if (k >= a[i] && dp[j][k-a[i]]>0)

					dp[j+1][k]+=dp[j][k-a[i]];

			}

		}

	}

	for (i=1;i<=n;i++) ans+=dp[i][val*i];

	cout<<ans;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



long long F[60][2601],n,K,a[210];

long long ans,tmp[60][2601];

int main()

{

	scanf("%lld%lld",&n,&K);

	for(int i=1;i<=n;i++) scanf("%lld",&a[i]); F[0][0]=1;

	for(int i=1;i<=n;i++)

	{

		memset(tmp,0,sizeof tmp);

		for(int j=0;j<i;j++)

			for(int k=0;k<=2501;k++)

			{		

				tmp[j+1][k+a[i]]+=F[j][k];

				tmp[j][k]+=F[j][k];

			}

		for(int j=0;j<=i;j++)

			for(int k=0;k<=2501;k++) 

				F[j][k]=tmp[j][k];

	}

	for(int i=1;i<=n;i++) if(i*K<=2500) ans+=F[i][i*K];

	cout << ans << endl; return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.962893708067531x):
//#include<stdio.h>

//#include<stdlib.h>

//#include<string.h>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N=55;

const ll MOD=1e9+7;

int main()

{

    int n;

    int a;

//for(auto &a:b)

//存在n*n种组合方法，求解满足条件的方法，遍历？

    cin>>n>>a;

    ll b[N][N*N]= {0};

    int p;

    ll cnt=0;//计算方法数

    b[0][0]=1;

    for(int i=1; i<=n; i++)

    {

        cin>>p;

        for(int j=i-1; j>=0; j--)

        {

            for(int k=0; k<=N*j; k++)

            {

                b[j+1][p+k]+=b[j][k];//将每一种可能加到一个p+k，使得每一个可能的和的地方数组储存的数字都为1

            }

        }

    }

    for(int i=1; i<=n; i++)

    {

        cnt+=b[i][i*a];//若是i*a处不为0则说明p+k可以加到这个位置

    }

    cout<<cnt<<endl;

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



long long F[60][2601],n,K,a[210];

long long ans,tmp[60][2601];

int main()

{

	scanf("%lld%lld",&n,&K);

	for(int i=1;i<=n;i++) scanf("%lld",&a[i]); F[0][0]=1;

	for(int i=1;i<=n;i++)

	{

		memset(tmp,0,sizeof tmp);

		for(int j=0;j<i;j++)

			for(int k=0;k<=2501;k++)

			{		

				tmp[j+1][k+a[i]]+=F[j][k];

				tmp[j][k]+=F[j][k];

			}

		for(int j=0;j<=i;j++)

			for(int k=0;k<=2501;k++) 

				F[j][k]=tmp[j][k];

	}

	for(int i=1;i<=n;i++) if(i*K<=2500) ans+=F[i][i*K];

	cout << ans << endl; return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.5375258748387313x):
//sieu nhan

#include <bits/stdc++.h>

using namespace std;

mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());

#define rand rd

#define int long long

#define inp "test.inp"

#define out "test.out"

#define oo 55

#define inf 1e15

#define mod 1000000007

#define rese(x,y) memset(x,y,sizeof(x))

#define pii pair<int,int>

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pf push_front

#define y1 hungdzno1

int n,A,a[oo],f[oo][oo*100];

void nhap(){

  cin>>n>>A;

  for(int i=1;i<=n;++i) cin>>a[i];

}

void xuly(){

  f[0][2500]=1;

  for(int i=1;i<=n;++i){

		a[i]-=A;

		for(int j=0;j<5001;++j){

			f[i][j]+=f[i-1][j];

			f[i][j+a[i]]+=f[i-1][j];

		}

	}

	cout<<f[n][2500]-1;

}

main(){

  ios::sync_with_stdio(0);

  cin.tie(0);

  cout.tie(0);

  nhap();

  xuly();

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define int long long

#define MAXN 52

#define MOD 1000000007

#define sz(a) static_cast<long long>(a.size())

#define INF 2000000000000000000

#define pb push_back

#define mp make_pair

using namespace std;

typedef pair<int,int> pp;

int n,a[MAXN],dp[MAXN][MAXN*MAXN],ans=0,val;

main(){

	//ios::sync_with_stdio(false); cin.tie(0);

	//freopen("inp.txt","r",stdin); //freopen("out.txt","w",stdout);

	//freopen(".INP","r",stdin); freopen(".OUT","w",stdout);

	cin>>n>>val; int i,j,k;

	for (i=1;i<=n;i++) cin>>a[i];

	for (i=0;i<MAXN;i++){

		for (j=0;j<MAXN*MAXN;j++) dp[i][j]=0;

	}

	dp[0][0]=1;

	for (i=1;i<=n;i++){

		for (j=i-1;j>=0;j--){

			for (k=2500;k>=0;k--){

				if (k >= a[i] && dp[j][k-a[i]]>0)

					dp[j+1][k]+=dp[j][k-a[i]];

			}

		}

	}

	for (i=1;i<=n;i++) ans+=dp[i][val*i];

	cout<<ans;

}

// Faster C++ solution for the same problem (measured speedup: 1.6192797517797561x):
//sieu nhan

#include <bits/stdc++.h>

using namespace std;

mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());

#define rand rd

#define int long long

#define inp "test.inp"

#define out "test.out"

#define oo 55

#define inf 1e15

#define mod 1000000007

#define rese(x,y) memset(x,y,sizeof(x))

#define pii pair<int,int>

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pf push_front

#define y1 hungdzno1

int n,A,a[oo],f[oo][oo*100];

void nhap(){

  cin>>n>>A;

  for(int i=1;i<=n;++i) cin>>a[i];

}

void xuly(){

  f[0][2500]=1;

  for(int i=1;i<=n;++i){

		a[i]-=A;

		for(int j=0;j<5001;++j){

			f[i][j]+=f[i-1][j];

			f[i][j+a[i]]+=f[i-1][j];

		}

	}

	cout<<f[n][2500]-1;

}

main(){

  ios::sync_with_stdio(0);

  cin.tie(0);

  cout.tie(0);

  nhap();

  xuly();

}
// Slower C++ solution:
//#include<stdio.h>

//#include<stdlib.h>

//#include<string.h>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N=55;

const ll MOD=1e9+7;

int main()

{

    int n;

    int a;

//for(auto &a:b)

//存在n*n种组合方法，求解满足条件的方法，遍历？

    cin>>n>>a;

    ll b[N][N*N]= {0};

    int p;

    ll cnt=0;//计算方法数

    b[0][0]=1;

    for(int i=1; i<=n; i++)

    {

        cin>>p;

        for(int j=i-1; j>=0; j--)

        {

            for(int k=0; k<=N*j; k++)

            {

                b[j+1][p+k]+=b[j][k];//将每一种可能加到一个p+k，使得每一个可能的和的地方数组储存的数字都为1

            }

        }

    }

    for(int i=1; i<=n; i++)

    {

        cnt+=b[i][i*a];//若是i*a处不为0则说明p+k可以加到这个位置

    }

    cout<<cnt<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.5217417452671391x):
//sieu nhan

#include <bits/stdc++.h>

using namespace std;

mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());

#define rand rd

#define int long long

#define inp "test.inp"

#define out "test.out"

#define oo 55

#define inf 1e15

#define mod 1000000007

#define rese(x,y) memset(x,y,sizeof(x))

#define pii pair<int,int>

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pf push_front

#define y1 hungdzno1

int n,A,a[oo],f[oo][oo*100];

void nhap(){

  cin>>n>>A;

  for(int i=1;i<=n;++i) cin>>a[i];

}

void xuly(){

  f[0][2500]=1;

  for(int i=1;i<=n;++i){

		a[i]-=A;

		for(int j=0;j<5001;++j){

			f[i][j]+=f[i-1][j];

			f[i][j+a[i]]+=f[i-1][j];

		}

	}

	cout<<f[n][2500]-1;

}

main(){

  ios::sync_with_stdio(0);

  cin.tie(0);

  cout.tie(0);

  nhap();

  xuly();

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define fr(i,x,y) for(int i=x;i<=y;++i)

#define rf(i,x,y) for(int i=x;i>=y;--i)

#define ll long long

using namespace std;

const int N=55,M=2510;

int a[N];

ll dp[2][N][M];



int main(){

	int n,m;scanf("%d%d",&n,&m);

	fr(i,1,n) scanf("%d",&a[i]);

	dp[0][0][0]=1;

	int nw=0;

	fr(i,1,n){

		memset(dp[nw^1],0,sizeof dp[nw^1]);

		fr(j,0,i-1) fr(k,0,2500){

			if(!dp[nw][j][k]) continue;

			dp[nw^1][j][k]+=dp[nw][j][k];

			dp[nw^1][j+1][k+a[i]]+=dp[nw][j][k];

		}

		nw^=1;

	}

	ll ans=0;

	fr(i,1,n) ans+=dp[nw][i][i*m];

	printf("%lld\n",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.212828853109947x):
//sieu nhan

#include <bits/stdc++.h>

using namespace std;

mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());

#define rand rd

#define int long long

#define inp "test.inp"

#define out "test.out"

#define oo 55

#define inf 1e15

#define mod 1000000007

#define rese(x,y) memset(x,y,sizeof(x))

#define pii pair<int,int>

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pf push_front

#define y1 hungdzno1

int n,A,a[oo],f[oo][oo*100];

void nhap(){

  cin>>n>>A;

  for(int i=1;i<=n;++i) cin>>a[i];

}

void xuly(){

  f[0][2500]=1;

  for(int i=1;i<=n;++i){

		a[i]-=A;

		for(int j=0;j<5001;++j){

			f[i][j]+=f[i-1][j];

			f[i][j+a[i]]+=f[i-1][j];

		}

	}

	cout<<f[n][2500]-1;

}

main(){

  ios::sync_with_stdio(0);

  cin.tie(0);

  cout.tie(0);

  nhap();

  xuly();

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



long long F[60][2601],n,K,a[210];

long long ans,tmp[60][2601];

int main()

{

	scanf("%lld%lld",&n,&K);

	for(int i=1;i<=n;i++) scanf("%lld",&a[i]); F[0][0]=1;

	for(int i=1;i<=n;i++)

	{

		memset(tmp,0,sizeof tmp);

		for(int j=0;j<i;j++)

			for(int k=0;k<=2501;k++)

			{		

				tmp[j+1][k+a[i]]+=F[j][k];

				tmp[j][k]+=F[j][k];

			}

		for(int j=0;j<=i;j++)

			for(int k=0;k<=2501;k++) 

				F[j][k]=tmp[j][k];

	}

	for(int i=1;i<=n;i++) if(i*K<=2500) ans+=F[i][i*K];

	cout << ans << endl; return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.820848285505777x):
#include<bits/stdc++.h>



#define sci(a) scanf("%d", &a)

#define fto(i, a, b) for (int i = a; i <= b; ++i)

#define fdto(i, a, b) for (int i = a; i >= b; --i)

#define scii(a, b) scanf("%d %d", &a, &b)

#define ll long long

#define ff first

#define ss second

#define vi vector<int>

#define ii pair<int, int>

#define vii vector<ii>

#define pii pair<int, ii>

#define maxN 105

#define oo 1000000007

#define mp make_pair

#define pb push_back

#define bug(a) cout << #a << "= " << a << endl;

#define bug2(a, b) cout << #a << "= " << a << "; " << #b << "= " << b << endl

#define pri(a) printf("%d", a)

#define pril(a) printf("%d\n", a)



using namespace std;



int n, A;

int a[maxN];

ll f[maxN][maxN*maxN];



int main() {

//    #ifndef ONLINE_JUDGE

//    freopen("cf.inp", "r", stdin);

//    freopen("cf.out", "w", stdout);

//    #endif



    scii(n, A);

    fto(i, 1, n) sci(a[i]), a[i] -= A;

//    f[0][0] = 1;

//    fto(i, 1, n) {

//        fto(j, 0, A-1) {

//            fto(k, 0, i-1) {

//                bug2(k, (j-a[i]%A+A)%A);

//                bug(f[k][(j-a[i]%A+A)%A]);

//                f[i][j] += f[k][(j-a[i]%A+A)%A];

//            }

//            bug2(i, j);

//            bug(f[i][j]);

//        }

//    }

    int M = 2500;

    f[0][M] = 1;

    fto(i, 1, n) {

        fto(j, -M, M) {

            int k = j-a[i]+M;

            if(k < 0 || k>2*M) continue;

//            bug2(i, j+M);

            f[i][j+M] = f[i-1][j+M]+f[i-1][k];

        }

    }

    cout << f[n][M]-1 << '\n';

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define int long long

#define MAXN 52

#define MOD 1000000007

#define sz(a) static_cast<long long>(a.size())

#define INF 2000000000000000000

#define pb push_back

#define mp make_pair

using namespace std;

typedef pair<int,int> pp;

int n,a[MAXN],dp[MAXN][MAXN*MAXN],ans=0,val;

main(){

	//ios::sync_with_stdio(false); cin.tie(0);

	//freopen("inp.txt","r",stdin); //freopen("out.txt","w",stdout);

	//freopen(".INP","r",stdin); freopen(".OUT","w",stdout);

	cin>>n>>val; int i,j,k;

	for (i=1;i<=n;i++) cin>>a[i];

	for (i=0;i<MAXN;i++){

		for (j=0;j<MAXN*MAXN;j++) dp[i][j]=0;

	}

	dp[0][0]=1;

	for (i=1;i<=n;i++){

		for (j=i-1;j>=0;j--){

			for (k=2500;k>=0;k--){

				if (k >= a[i] && dp[j][k-a[i]]>0)

					dp[j+1][k]+=dp[j][k-a[i]];

			}

		}

	}

	for (i=1;i<=n;i++) ans+=dp[i][val*i];

	cout<<ans;

}

// Faster C++ solution for the same problem (measured speedup: 1.8088292560476071x):
#include<bits/stdc++.h>



#define sci(a) scanf("%d", &a)

#define fto(i, a, b) for (int i = a; i <= b; ++i)

#define fdto(i, a, b) for (int i = a; i >= b; --i)

#define scii(a, b) scanf("%d %d", &a, &b)

#define ll long long

#define ff first

#define ss second

#define vi vector<int>

#define ii pair<int, int>

#define vii vector<ii>

#define pii pair<int, ii>

#define maxN 105

#define oo 1000000007

#define mp make_pair

#define pb push_back

#define bug(a) cout << #a << "= " << a << endl;

#define bug2(a, b) cout << #a << "= " << a << "; " << #b << "= " << b << endl

#define pri(a) printf("%d", a)

#define pril(a) printf("%d\n", a)



using namespace std;



int n, A;

int a[maxN];

ll f[maxN][maxN*maxN];



int main() {

//    #ifndef ONLINE_JUDGE

//    freopen("cf.inp", "r", stdin);

//    freopen("cf.out", "w", stdout);

//    #endif



    scii(n, A);

    fto(i, 1, n) sci(a[i]), a[i] -= A;

//    f[0][0] = 1;

//    fto(i, 1, n) {

//        fto(j, 0, A-1) {

//            fto(k, 0, i-1) {

//                bug2(k, (j-a[i]%A+A)%A);

//                bug(f[k][(j-a[i]%A+A)%A]);

//                f[i][j] += f[k][(j-a[i]%A+A)%A];

//            }

//            bug2(i, j);

//            bug(f[i][j]);

//        }

//    }

    int M = 2500;

    f[0][M] = 1;

    fto(i, 1, n) {

        fto(j, -M, M) {

            int k = j-a[i]+M;

            if(k < 0 || k>2*M) continue;

//            bug2(i, j+M);

            f[i][j+M] = f[i-1][j+M]+f[i-1][k];

        }

    }

    cout << f[n][M]-1 << '\n';

    return 0;

}