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

#include <vector>

#include <string>

#include <algorithm>

#include <cstdio>

#include <cstring>

#include <cmath>

using namespace std;



int64_t dp[51][51][2501];



int main() {

    int n, a;

    cin >> n >> a;



    int x[50];

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

        cin >> x[i];

    }



    // 最初のi枚のうちj枚を使ってkを作る通り数

    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++) {

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

                if (k - x[i - 1] >= 0) dp[i][j][k] += dp[i - 1][j - 1][k - x[i - 1]];

            }

        }

    }



    int64_t r = 0;

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

        r += dp[n][j][j * a];

    }

    cout << r << endl;



    return 0;

}

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

#include <vector>

#include <string>

#include <algorithm>

#include <cstdio>

#include <cstring>

#include <cmath>

using namespace std;



int main() {

    int n, a;

    cin >> n >> a;



    int x[50];

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

        cin >> x[i];

        x[i] -= a;

    }



    // i枚目までを使ってkを作る通り数

    int s[2] = {};

    int64_t dp[2][5001] = {};

    int64_t *p[2];

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

        p[i] = &dp[i][2500];

    }

    p[0][0] = 1;

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

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

        for (int k = s[0]; k <= s[1]; k++) {

            p[1][k] = p[0][k] + p[0][k - x[i]];

        }

        swap(p[0], p[1]);

    }



    cout << p[0][0] - 1 << endl;



    return 0;

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

using namespace std;

long long dp[52][2501],n,a,sum,s;

int main()

{

	cin>>n>>a;

	dp[0][0]=1;

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

	{

		cin>>s;

		for(int k=n-1;k>=0;k--)

			for(int l=2500-s;l>=0;l--) 

			     dp[k+1][l+s]+=dp[k][l];

	}

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

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

			sum+=dp[i][j]*(j==i*a);

	cout<<sum<<endl;

}

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

#include <cstdio>

using namespace std;



int n, a;

int x[51];

long long dp[51][2501];





int main()

{

	long long sum(0ll), ans(0ll);

	

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

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

		scanf("%d", x + i);

	dp[0][0] = 1ll;

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

		sum += x[i];

		for (int j = i; j; --j)

			for (int k = sum; k >= x[i]; --k)

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

	}

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

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

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

	return 0;

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

#include<iostream>

#define ll long long

using namespace std;

int n,p,a[51];

ll f[51][51][2501],ans;

int main(){

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

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

	f[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++){

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

				if (j>=1&&k>=a[i])

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

			}

		}

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

		ans+=f[n][i][i*p];

	printf("%lld",ans);

	return 0;

}

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

#include <cstdio>

using namespace std;



int n, a;

int x[51];

long long dp[51][2501];





int main()

{

	long long sum(0ll), ans(0ll);

	

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

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

		scanf("%d", x + i);

	dp[0][0] = 1ll;

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

		sum += x[i];

		for (int j = i; j; --j)

			for (int k = sum; k >= x[i]; --k)

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

	}

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

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

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

	return 0;

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

using namespace std;

int n, A, a[51];

long long f[2][51][2510];

int main() {

	cin >> n >> A;

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

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

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

		memset(f[i & 1], 0, sizeof(f[i & 1]));

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

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

				f[i & 1][j][k] = ((k - a[i] >= 0 && j > 0) ? f[i & 1 ^ 1][j - 1][k - a[i]] : 0) + f[(i & 1) ^ 1][j][k];

			}

		}

	}

	long long ans = 0;

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

		ans += f[n & 1][i][i * A];

	}

	cout << ans << endl;

	return 0;

}

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

#include <cstdio>

using namespace std;



int n, a;

int x[51];

long long dp[51][2501];





int main()

{

	long long sum(0ll), ans(0ll);

	

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

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

		scanf("%d", x + i);

	dp[0][0] = 1ll;

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

		sum += x[i];

		for (int j = i; j; --j)

			for (int k = sum; k >= x[i]; --k)

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

	}

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

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

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

	return 0;

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

using namespace std;

long long dp[52][2501],n,a,sum,s;

int main()

{

	cin>>n>>a;

	dp[0][0]=1;

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

	{

		cin>>s;

		for(int k=n-1;k>=0;k--)

			for(int l=2500-s;l>=0;l--) 

			     dp[k+1][l+s]+=dp[k][l];

	}

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

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

			sum+=dp[i][j]*(j==i*a);

	cout<<sum<<endl;

}

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

#define del(a,i) memset(a,i,sizeof(a))

#define ll long long

#define inl inline

#define il inl void

#define it inl int

#define ill inl ll

#define re register

#define ri re int

#define rl re ll

#define mid ((l+r)>>1)

#define lowbit(x) (x&(-x))

#define INF 0x3f3f3f3f

using namespace std;

template<class T>il read(T &x)

{

	int f=1;char k=getchar();x=0;

	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;

	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';

	x*=f;

}

const int MAXN = 55;

int n,m,sum,val[MAXN];

ll dp[MAXN][2505],ans;

int main()

{

//	freopen(".in","r",stdin);

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

	read(n),read(m);dp[0][0]=1;

	for(ri i=1;i<=n;i++) read(val[i]),sum+=val[i];

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

		for(ri j=sum;j>=val[i];j--)

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

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

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

		if(i*m>sum) break;

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

	}

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

	return 0;

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

#include<iostream>

#define ll long long

using namespace std;

int n,p,a[51];

ll f[51][51][2501],ans;

int main(){

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

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

	f[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++){

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

				if (j>=1&&k>=a[i])

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

			}

		}

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

		ans+=f[n][i][i*p];

	printf("%lld",ans);

	return 0;

}

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

#define del(a,i) memset(a,i,sizeof(a))

#define ll long long

#define inl inline

#define il inl void

#define it inl int

#define ill inl ll

#define re register

#define ri re int

#define rl re ll

#define mid ((l+r)>>1)

#define lowbit(x) (x&(-x))

#define INF 0x3f3f3f3f

using namespace std;

template<class T>il read(T &x)

{

	int f=1;char k=getchar();x=0;

	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;

	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';

	x*=f;

}

const int MAXN = 55;

int n,m,sum,val[MAXN];

ll dp[MAXN][2505],ans;

int main()

{

//	freopen(".in","r",stdin);

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

	read(n),read(m);dp[0][0]=1;

	for(ri i=1;i<=n;i++) read(val[i]),sum+=val[i];

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

		for(ri j=sum;j>=val[i];j--)

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

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

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

		if(i*m>sum) break;

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

	}

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

	return 0;

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

using namespace std;

int n, A, a[51];

long long f[2][51][2510];

int main() {

	cin >> n >> A;

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

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

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

		memset(f[i & 1], 0, sizeof(f[i & 1]));

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

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

				f[i & 1][j][k] = ((k - a[i] >= 0 && j > 0) ? f[i & 1 ^ 1][j - 1][k - a[i]] : 0) + f[(i & 1) ^ 1][j][k];

			}

		}

	}

	long long ans = 0;

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

		ans += f[n & 1][i][i * A];

	}

	cout << ans << endl;

	return 0;

}

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

#define del(a,i) memset(a,i,sizeof(a))

#define ll long long

#define inl inline

#define il inl void

#define it inl int

#define ill inl ll

#define re register

#define ri re int

#define rl re ll

#define mid ((l+r)>>1)

#define lowbit(x) (x&(-x))

#define INF 0x3f3f3f3f

using namespace std;

template<class T>il read(T &x)

{

	int f=1;char k=getchar();x=0;

	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;

	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';

	x*=f;

}

const int MAXN = 55;

int n,m,sum,val[MAXN];

ll dp[MAXN][2505],ans;

int main()

{

//	freopen(".in","r",stdin);

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

	read(n),read(m);dp[0][0]=1;

	for(ri i=1;i<=n;i++) read(val[i]),sum+=val[i];

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

		for(ri j=sum;j>=val[i];j--)

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

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

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

		if(i*m>sum) break;

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

	}

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

	return 0;

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



using namespace std ; 



int n , ar , a[ 60 ] ;

long long f[ 60 ][ 60 ][ 2510 ] ;

//选到i，选了j个，sum为k 



int main() {

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

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

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

	}

	

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

	

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

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

			for( int k = ar * n + 1 ; k >= 0 ; k -- ) {

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

				if( k >= a[ i ] && j ) f[ i ][ j ][ k ] += f[ i - 1 ][ j - 1 ][ k - a[ i ] ] ;

			}

		}

	}

	long long ans = 0 ;

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

		ans += f[ n ][ i ][ ar * i ] ;

	}

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

} 

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

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

using namespace std;

long long dp[52][2501],n,a,sum,s;

int main()

{

	cin>>n>>a;

	dp[0][0]=1;

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

	{

		cin>>s;

		for(int k=n-1;k>=0;k--)

			for(int l=2500-s;l>=0;l--) 

			     dp[k+1][l+s]+=dp[k][l];

	}

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

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

			sum+=dp[i][j]*(j==i*a);

	cout<<sum<<endl;

}

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

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

#include<iostream>

#define ll long long

using namespace std;

int n,p,a[51];

ll f[51][51][2501],ans;

int main(){

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

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

	f[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++){

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

				if (j>=1&&k>=a[i])

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

			}

		}

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

		ans+=f[n][i][i*p];

	printf("%lld",ans);

	return 0;

}

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

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

using namespace std;

int n, A, a[51];

long long f[2][51][2510];

int main() {

	cin >> n >> A;

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

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

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

		memset(f[i & 1], 0, sizeof(f[i & 1]));

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

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

				f[i & 1][j][k] = ((k - a[i] >= 0 && j > 0) ? f[i & 1 ^ 1][j - 1][k - a[i]] : 0) + f[(i & 1) ^ 1][j][k];

			}

		}

	}

	long long ans = 0;

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

		ans += f[n & 1][i][i * A];

	}

	cout << ans << endl;

	return 0;

}

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

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

#include <cstdio>

using namespace std;



int n, a;

int x[51];

long long dp[51][2501];





int main()

{

	long long sum(0ll), ans(0ll);

	

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

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

		scanf("%d", x + i);

	dp[0][0] = 1ll;

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

		sum += x[i];

		for (int j = i; j; --j)

			for (int k = sum; k >= x[i]; --k)

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

	}

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

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

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

	return 0;

}




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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

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

#define del(a,i) memset(a,i,sizeof(a))

#define ll long long

#define inl inline

#define il inl void

#define it inl int

#define ill inl ll

#define re register

#define ri re int

#define rl re ll

#define mid ((l+r)>>1)

#define lowbit(x) (x&(-x))

#define INF 0x3f3f3f3f

using namespace std;

template<class T>il read(T &x)

{

	int f=1;char k=getchar();x=0;

	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;

	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';

	x*=f;

}

const int MAXN = 55;

int n,m,sum,val[MAXN];

ll dp[MAXN][2505],ans;

int main()

{

//	freopen(".in","r",stdin);

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

	read(n),read(m);dp[0][0]=1;

	for(ri i=1;i<=n;i++) read(val[i]),sum+=val[i];

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

		for(ri j=sum;j>=val[i];j--)

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

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

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

		if(i*m>sum) break;

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

	}

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

	return 0;

}

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

#define int long long

using namespace std;

int n,m,a[55],f[55][8005],ans;

signed main(){

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

	f[0][0]=1;

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

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

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

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

			for(int k=m*n;k>=a[i];k--)

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

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

		ans+=f[i][i*m];

	printf("%lld",ans);

	return 0;

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



using namespace std ; 



int n , ar , a[ 60 ] ;

long long f[ 60 ][ 60 ][ 2510 ] ;

//选到i，选了j个，sum为k 



int main() {

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

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

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

	}

	

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

	

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

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

			for( int k = ar * n + 1 ; k >= 0 ; k -- ) {

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

				if( k >= a[ i ] && j ) f[ i ][ j ][ k ] += f[ i - 1 ][ j - 1 ][ k - a[ i ] ] ;

			}

		}

	}

	long long ans = 0 ;

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

		ans += f[ n ][ i ][ ar * i ] ;

	}

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

} 

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

#include <cstdlib>

#define N 10001

#define int long long

#define rnt register int

using namespace std;

int n,A,x,ans,sum[N],dp[60][N];

signed main(){

	scanf("%lld%lld",&n,&A);dp[0][0]=1;

	for(rnt i=1;i<=n;i=-~i){

		scanf("%lld",&x);sum[i]=sum[i-1]+x;

		for(rnt j=i;~j;--j) for(rnt k=0;k<=sum[i];k=-~k) dp[j+1][k+x]+=dp[j][k];

	}

	for(rnt i=1;i<=n;i=-~i) ans+=dp[i][i*A];

	printf("%lld",ans);

	return 0;

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

using namespace std;

long long dp[52][2501],n,a,sum,s;

int main()

{

	cin>>n>>a;

	dp[0][0]=1;

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

	{

		cin>>s;

		for(int k=n-1;k>=0;k--)

			for(int l=2500-s;l>=0;l--) 

			     dp[k+1][l+s]+=dp[k][l];

	}

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

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

			sum+=dp[i][j]*(j==i*a);

	cout<<sum<<endl;

}

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

#include <cstdlib>

#define N 10001

#define int long long

#define rnt register int

using namespace std;

int n,A,x,ans,sum[N],dp[60][N];

signed main(){

	scanf("%lld%lld",&n,&A);dp[0][0]=1;

	for(rnt i=1;i<=n;i=-~i){

		scanf("%lld",&x);sum[i]=sum[i-1]+x;

		for(rnt j=i;~j;--j) for(rnt k=0;k<=sum[i];k=-~k) dp[j+1][k+x]+=dp[j][k];

	}

	for(rnt i=1;i<=n;i=-~i) ans+=dp[i][i*A];

	printf("%lld",ans);

	return 0;

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

#include<iostream>

#define ll long long

using namespace std;

int n,p,a[51];

ll f[51][51][2501],ans;

int main(){

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

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

	f[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++){

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

				if (j>=1&&k>=a[i])

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

			}

		}

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

		ans+=f[n][i][i*p];

	printf("%lld",ans);

	return 0;

}

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

#include <cstdlib>

#define N 10001

#define int long long

#define rnt register int

using namespace std;

int n,A,x,ans,sum[N],dp[60][N];

signed main(){

	scanf("%lld%lld",&n,&A);dp[0][0]=1;

	for(rnt i=1;i<=n;i=-~i){

		scanf("%lld",&x);sum[i]=sum[i-1]+x;

		for(rnt j=i;~j;--j) for(rnt k=0;k<=sum[i];k=-~k) dp[j+1][k+x]+=dp[j][k];

	}

	for(rnt i=1;i<=n;i=-~i) ans+=dp[i][i*A];

	printf("%lld",ans);

	return 0;

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

using namespace std;

int n, A, a[51];

long long f[2][51][2510];

int main() {

	cin >> n >> A;

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

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

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

		memset(f[i & 1], 0, sizeof(f[i & 1]));

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

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

				f[i & 1][j][k] = ((k - a[i] >= 0 && j > 0) ? f[i & 1 ^ 1][j - 1][k - a[i]] : 0) + f[(i & 1) ^ 1][j][k];

			}

		}

	}

	long long ans = 0;

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

		ans += f[n & 1][i][i * A];

	}

	cout << ans << endl;

	return 0;

}

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

#include <cstdlib>

#define N 10001

#define int long long

#define rnt register int

using namespace std;

int n,A,x,ans,sum[N],dp[60][N];

signed main(){

	scanf("%lld%lld",&n,&A);dp[0][0]=1;

	for(rnt i=1;i<=n;i=-~i){

		scanf("%lld",&x);sum[i]=sum[i-1]+x;

		for(rnt j=i;~j;--j) for(rnt k=0;k<=sum[i];k=-~k) dp[j+1][k+x]+=dp[j][k];

	}

	for(rnt i=1;i<=n;i=-~i) ans+=dp[i][i*A];

	printf("%lld",ans);

	return 0;

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

#include <cstdio>

using namespace std;



int n, a;

int x[51];

long long dp[51][2501];





int main()

{

	long long sum(0ll), ans(0ll);

	

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

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

		scanf("%d", x + i);

	dp[0][0] = 1ll;

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

		sum += x[i];

		for (int j = i; j; --j)

			for (int k = sum; k >= x[i]; --k)

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

	}

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

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

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

	return 0;

}




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

#include <cstdlib>

#define N 10001

#define int long long

#define rnt register int

using namespace std;

int n,A,x,ans,sum[N],dp[60][N];

signed main(){

	scanf("%lld%lld",&n,&A);dp[0][0]=1;

	for(rnt i=1;i<=n;i=-~i){

		scanf("%lld",&x);sum[i]=sum[i-1]+x;

		for(rnt j=i;~j;--j) for(rnt k=0;k<=sum[i];k=-~k) dp[j+1][k+x]+=dp[j][k];

	}

	for(rnt i=1;i<=n;i=-~i) ans+=dp[i][i*A];

	printf("%lld",ans);

	return 0;

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

#define del(a,i) memset(a,i,sizeof(a))

#define ll long long

#define inl inline

#define il inl void

#define it inl int

#define ill inl ll

#define re register

#define ri re int

#define rl re ll

#define mid ((l+r)>>1)

#define lowbit(x) (x&(-x))

#define INF 0x3f3f3f3f

using namespace std;

template<class T>il read(T &x)

{

	int f=1;char k=getchar();x=0;

	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;

	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';

	x*=f;

}

const int MAXN = 55;

int n,m,sum,val[MAXN];

ll dp[MAXN][2505],ans;

int main()

{

//	freopen(".in","r",stdin);

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

	read(n),read(m);dp[0][0]=1;

	for(ri i=1;i<=n;i++) read(val[i]),sum+=val[i];

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

		for(ri j=sum;j>=val[i];j--)

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

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

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

		if(i*m>sum) break;

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

	}

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

	return 0;

}

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

#include <cstdlib>

#define N 10001

#define int long long

#define rnt register int

using namespace std;

int n,A,x,ans,sum[N],dp[60][N];

signed main(){

	scanf("%lld%lld",&n,&A);dp[0][0]=1;

	for(rnt i=1;i<=n;i=-~i){

		scanf("%lld",&x);sum[i]=sum[i-1]+x;

		for(rnt j=i;~j;--j) for(rnt k=0;k<=sum[i];k=-~k) dp[j+1][k+x]+=dp[j][k];

	}

	for(rnt i=1;i<=n;i=-~i) ans+=dp[i][i*A];

	printf("%lld",ans);

	return 0;

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



using namespace std;



typedef long long ll;



ll n, A, a[51], dp[55][55][2700]{};



int main() {

	

	cin >> n >> A;

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

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

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

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

			for (int k = 0; k <= 2600; k++) {

				if (k - a[i] >= 0)dp[i + 1][j + 1][k] += dp[i][j][k-a[i]];

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

			}

		}

	}

	ll ans = 0;

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

		for (int j = 1; j <= 2700; j++) {

			if (j%i == 0 && j / i == A)ans += dp[n][i][j];

		}

	}

	cout << ans << endl;

	return 0;

}

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

using namespace std;

typedef long long ll;



int main() {

    int n, a;

    cin >> n >> a;

    vector<int> x(n);

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

        cin >> x[i];

        x[i] -= a;

    }

    vector<map<int,ll> > dp(n+1);

    dp[0][0] = 1;

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

        for(auto p : dp[i]){

            dp[i+1][p.first+x[i]] += p.second;

            dp[i+1][p.first] += p.second;

        }

    }

    cout << dp[n][0]-1 << endl;

    return 0;

}