stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
//### In The Name Of GOD ###



#include <bits/stdc++.h>



using namespace std;



typedef long long ll ;



const int MOD = 1000000007;

const int INF = 30 * 1000 + 20;

const int MAXN = 2600;

const int MLOG = 18;

const int NMAX = 60;



#define int ll

#define pb push_back

#define pp pop_back

#define X first

#define Y second

#define IO ios_base::sync_with_stdio(false);

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

#define ct(x) const_cast<const int&>(x)



int what[MAXN][NMAX][NMAX];



int32_t main(){

	int n,A;

	cin >> n >> A;

	int x[ct(n)];

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

	what[0][i][0] = 1;

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

		cin >> x[i];

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

			for(int k = 1; k < NMAX; k++){

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

			}

		}

		for(int j=x[i];j<2550;j++){

			for(int k = 1; k < NMAX; k++){

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

//				if(what[j][i+1][k] > 0)

//				cerr << j << ' ' << i+1 << ' ' << k << ' '<< what[j][i+1][k] << endl;

			}

		}

	}

	int ans = 0;

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

		ans += what[A*i][n][i];

	}

	cout << ans;

}

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

using namespace std;



const int maxn = 55;



long long f[maxn * maxn][maxn];

int x[maxn];



int main() {

	ios::sync_with_stdio(0);

	cin.tie(0); cout.tie(0);

	int n, a, s = 0; cin >> n >> a;

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

		cin >> x[i]; s += x[i];

	}

	f[0][0] = 1;

	for(int i = 0; i < n; ++ i) for(int j = s; j >= x[i]; -- j) {

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

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

	}

	long long ans = 0;

	for(int i = 0; i <= s; ++ i) for(int j = 0; j <= n; ++ j) if(i == j * a) ans += f[i][j];

	cout << ans - 1 << "\n";

	return 0;

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

#include<cstdio>

#include<map>

#include<sstream>

#include<cstring>

#include<algorithm>

#include<string>

using namespace std;

long long ans = 0;

int main()

{

    int n,a,x;

    cin >> n >> a;

    long long f[60][2600];

    memset(f,0,sizeof(f));

    f[0][0] = 1;//零个数字的和为零的状况有一种

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

    {

        cin >> x ;

        for(int j = i; j > 0; j --)//对于前i个数字

        {

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

            {

                f[j][k]+=f[j-1][k-x];

                //if(f[j][k])cout <<"j: " << j << " k: " << k <<" fjk " << f[j][k] <<endl;

            }

        //cout << f[j][j*a] <<endl;

        }

    }

    long long ans = 0;

    for(int i = 1; i <= n; i ++)ans += f[i][a*i];

    cout << ans <<endl;

    return 0;

}


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

using namespace std;

using ll = long long;

ll dp[55][3000], x[55];

int main(){

	int n, a;

	cin >> n >> a;

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

		cin >> x[i];

	}

	dp[0][0] = 1;

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

		for(int cnt = n; cnt >= 0; cnt --){

			for(int sum = 3000; sum >= 0; sum --){

				if(!dp[cnt][sum]) continue;

				dp[cnt + 1][sum + x[i]] += dp[cnt][sum];

			}

		}

	}

	ll ans = 0;

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

	cout << ans << '\n';

	return 0;

}
// Slower C++ solution:
//### In The Name Of GOD ###



#include <bits/stdc++.h>



using namespace std;



typedef long long ll ;



const int MOD = 1000000007;

const int INF = 30 * 1000 + 20;

const int MAXN = 2600;

const int MLOG = 18;

const int NMAX = 60;



#define int ll

#define pb push_back

#define pp pop_back

#define X first

#define Y second

#define IO ios_base::sync_with_stdio(false);

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

#define ct(x) const_cast<const int&>(x)



int what[MAXN][NMAX][NMAX];



int32_t main(){

	int n,A;

	cin >> n >> A;

	int x[ct(n)];

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

	what[0][i][0] = 1;

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

		cin >> x[i];

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

			for(int k = 1; k < NMAX; k++){

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

			}

		}

		for(int j=x[i];j<2550;j++){

			for(int k = 1; k < NMAX; k++){

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

//				if(what[j][i+1][k] > 0)

//				cerr << j << ' ' << i+1 << ' ' << k << ' '<< what[j][i+1][k] << endl;

			}

		}

	}

	int ans = 0;

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

		ans += what[A*i][n][i];

	}

	cout << ans;

}

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

using namespace std;

using ll = long long;

ll dp[55][3000], x[55];

int main(){

	int n, a;

	cin >> n >> a;

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

		cin >> x[i];

	}

	dp[0][0] = 1;

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

		for(int cnt = n; cnt >= 0; cnt --){

			for(int sum = 3000; sum >= 0; sum --){

				if(!dp[cnt][sum]) continue;

				dp[cnt + 1][sum + x[i]] += dp[cnt][sum];

			}

		}

	}

	ll ans = 0;

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

	cout << ans << '\n';

	return 0;

}
// Slower C++ solution:
//In the name of God

#include<bits/stdc++.h>

#define int long long



using namespace std;



int n , A , a[60] , dp[60][60][3000];



int32_t main(){

        ios_base::sync_with_stdio(false);

        cin.tie(0);

        cout.tie(0);

        cin >> n >> A;

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

                cin >> a[i];

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

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

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

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

                        for(int k=1 ; k < 2800 ; k++){

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

                                if(k >= a[i])

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

                        }

        }

        int res = 0;

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

                res += dp[n][i][i*A];

        cout << res;

} 

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

using namespace std;

int x[55];

long long dp[55][55*55];

int main()

{

	int n,a;

	cin >> n >> a;

	dp[0][0] = 1;

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

	cin >> x[i];

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

	{

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

		for(long long k = 55*j;k >=0 ;k--)

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

	}

	long long ans = 0;

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

	{

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

	}

	cout << ans << endl;

	return 0;

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

#include<cstdio>

#include<map>

#include<sstream>

#include<cstring>

#include<algorithm>

#include<string>

using namespace std;

long long ans = 0;

int main()

{

    int n,a,x;

    cin >> n >> a;

    long long f[60][2600];

    memset(f,0,sizeof(f));

    f[0][0] = 1;//零个数字的和为零的状况有一种

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

    {

        cin >> x ;

        for(int j = i; j > 0; j --)//对于前i个数字

        {

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

            {

                f[j][k]+=f[j-1][k-x];

                //if(f[j][k])cout <<"j: " << j << " k: " << k <<" fjk " << f[j][k] <<endl;

            }

        //cout << f[j][j*a] <<endl;

        }

    }

    long long ans = 0;

    for(int i = 1; i <= n; i ++)ans += f[i][a*i];

    cout << ans <<endl;

    return 0;

}


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

using namespace std;

int x[55];

long long dp[55][55*55];

int main()

{

	int n,a;

	cin >> n >> a;

	dp[0][0] = 1;

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

	cin >> x[i];

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

	{

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

		for(long long k = 55*j;k >=0 ;k--)

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

	}

	long long ans = 0;

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

	{

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

	}

	cout << ans << endl;

	return 0;

}
// Slower C++ solution:
//### In The Name Of GOD ###



#include <bits/stdc++.h>



using namespace std;



typedef long long ll ;



const int MOD = 1000000007;

const int INF = 30 * 1000 + 20;

const int MAXN = 2600;

const int MLOG = 18;

const int NMAX = 60;



#define int ll

#define pb push_back

#define pp pop_back

#define X first

#define Y second

#define IO ios_base::sync_with_stdio(false);

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

#define ct(x) const_cast<const int&>(x)



int what[MAXN][NMAX][NMAX];



int32_t main(){

	int n,A;

	cin >> n >> A;

	int x[ct(n)];

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

	what[0][i][0] = 1;

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

		cin >> x[i];

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

			for(int k = 1; k < NMAX; k++){

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

			}

		}

		for(int j=x[i];j<2550;j++){

			for(int k = 1; k < NMAX; k++){

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

//				if(what[j][i+1][k] > 0)

//				cerr << j << ' ' << i+1 << ' ' << k << ' '<< what[j][i+1][k] << endl;

			}

		}

	}

	int ans = 0;

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

		ans += what[A*i][n][i];

	}

	cout << ans;

}

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

using namespace std;

int x[55];

long long dp[55][55*55];

int main()

{

	int n,a;

	cin >> n >> a;

	dp[0][0] = 1;

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

	cin >> x[i];

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

	{

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

		for(long long k = 55*j;k >=0 ;k--)

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

	}

	long long ans = 0;

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

	{

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

	}

	cout << ans << endl;

	return 0;

}
// 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: 10.770562691356439x):
#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 );

}
// 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: 5.7178158670231145x):
#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 );

}
// 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: 18.39749374789818x):
#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 );

}
// 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: 1.4653656868585754x):
#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;



}
// 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: 4.573439411750629x):
#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;



}
// 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: 0.8810694285260744x):
#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;

}
// 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: 4.398981776239262x):
#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;

}
// 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: 1.5553184799019162x):
#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;

}
// 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: 4.608000849016953x):
#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;

}