stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i,n)for(long long i=0;i<(long long)(n);i++)

#define all(a) a.begin(), a.end()

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef pair<ll, ll> P;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

 

const ll MOD=1e9+7;

const ll INF=1e18;

const int MAX=510000;

const double pi=acos(-1);

int dx[8] = {1,0,-1,0,1,1,-1,-1};

int dy[8] = {0,1,0,-1,-1,1,1,-1};

// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};



ll dp[55][5000];

int main(){

  cin.tie(0);

  ios::sync_with_stdio(false); 

  

  int n,a;

  cin >> n >> a;

  vector<int> x(n);

  rep(i,n){

    cin >> x[i];

    x[i]-=a;

  }

  

  memset(dp,0,sizeof(dp));

  dp[0][2500]=1;

  rep(i,n){

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

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

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

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

    }        

  }

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



  return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define rep(i,n)for(long long i=0;i<(long long)(n);i++)

#define all(a) a.begin(), a.end()

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef pair<ll, ll> P;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

 

const ll MOD=1e9+7;

const ll INF=1e18;

const int MAX=510000;

const double pi=acos(-1);

int dx[8] = {1,0,-1,0,1,1,-1,-1};

int dy[8] = {0,1,0,-1,-1,1,1,-1};

// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};





int main(){

  cin.tie(0);

  ios::sync_with_stdio(false); 

  

  int n,a;

  cin >> n >> a;

  vector<int>x(n);

  rep(i,n) cin >> x[i];

  ll dp[n+10][n+10][50*n+100]={};

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

  

  rep(i,n){

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

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

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

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

      }

    }

  }

  ll res = 0;

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

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

  }

  cout << res << endl;

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



typedef long long  ll;



ll MOD = 1000000007;

ll INF = 100000000000000;

double PI = 3.1415926535;



template<typename T>

void remove(std::vector<T>& vector, unsigned int index)

{

    vector.erase(vector.begin() + index);

}



using Graph = vector<vector<ll>>;



int main(){

    int N,A;cin >> N >> A;

    vector<int> X(N);

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

        cin >> X[i];

    }

    vector<vector<vector<ll>>> dp(N+1,vector<vector<ll>>((N+1),vector<ll>(2510)));

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

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

    }

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

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

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

                if(k >= X[i]){

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

                }else{

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

                }

            }

        }

    }

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

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

            cout << dp[N][i][j] << ' ';

        }

        cout << endl;

    }*/

    ll ans = 0;

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

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

            if(j % i == 0 && j / i == A){

                ans += dp[N][i][j];

            }

        }

    }

    cout << ans << endl;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long  ll;

#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)

#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)

#define rep(i,n) FOR(i,0,n)

#define rrep(i,n) RFOR(i,0,n)

#define ALL(v) v.begin(), v.end()

#define bra(first,second) '(' << first << ',' << second << ')'

ll MOD = 1000000007;

ll INF = 214748364700000000;

long double EPS = 1e-11;

long double PI = 3.141592653589793238;

template<typename T>

void remove(std::vector<T>& vector, unsigned int index){

    vector.erase(vector.begin() + index);

}



using Graph = vector<vector<pair<ll,ll>>>;



ll dp[60][60][2500];



int main(){

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

   vector<ll> X(N);

   rep(i,N) cin >> X[i];

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

   rep(i,N){

       rep(j,N+1){

           rep(k,2501){

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

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

           }

       }

   }

   ll ans = 0;

   FOR(i,1,N+1) rep(k,2501){

       if(A * i == k) ans += dp[N][i][k];

   }

   cout << ans << endl;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <algorithm>

#include <cmath>

#include <iomanip>

#include <iostream>

#include <limits>

#include <map>

#include <queue>

#include <set>

#include <tuple>

#include <vector>



using namespace std;



#define rep(i, n) for (int64_t i = 0; i < (n); i++)

#define irep(i, n) for (int64_t i = 0; i <= (n); i++)

#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)

#define rirep(i, n) for (int64_t i = n; i >= 0; i--)



int x[50];

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



int main()

{

    int n, a;

    cin >> n >> a;

    rep(i, n)

    {

        cin >> x[i];

    }



    irep(i, n)

    {

        irep(j, n)

        {

            irep(k, 2500)

            {

                if (i == 0) {

                    dp[i][j][k] = j == 0 && k == 0 ? 1 : 0;

                } else {

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

                    if (j - 1 >= 0 && k - x[i - 1] >= 0) {

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

                    }

                }

            }

        }

    }



    int64_t result = 0;

    irep(i, n)

    {

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

    }

    cout << result - 1 << endl;



    return 0;

}

// Optimized solution to the same problem (faster):
#include <algorithm>

#include <cmath>

#include <iomanip>

#include <iostream>

#include <limits>

#include <map>

#include <queue>

#include <set>

#include <tuple>

#include <vector>



using namespace std;



#define rep(i, n) for (int64_t i = 0; i < (n); i++)

#define irep(i, n) for (int64_t i = 0; i <= (n); i++)

#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)

#define rirep(i, n) for (int64_t i = n; i >= 0; i--)



int x[50];

int64_t dp[51][5'001];



int main()

{

    int n, a;

    cin >> n >> a;

    rep(i, n)

    {

        cin >> x[i];

        x[i] -= a;

    }



    irep(i, n)

    {

        for (int j = -2500; j <= 2500; j++) {

            int jidx = (j + 5'000) % 5'000;

            if (i == 0) {

                dp[i][jidx] = j == 0 ? 1 : 0;

            } else {

                dp[i][jidx] = dp[i - 1][jidx];

                if (-2500 <= j - x[i - 1] && j - x[i - 1] <= 2500) {

                    dp[i][jidx] += dp[i - 1][(j - x[i - 1] + 5'000) % 5'000];

                }

            }

        }

    }



    int64_t result = dp[n][0];

    cout << result - 1 << endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int x[55];

typedef long long ll;

ll n,a;

ll dp[55][55][2550];

int main()

{

    cin>>n>>a;

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

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

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

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

    for(int k=0;k<n*a;k++)

    {

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

        dp[i+1][j][k]+=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;

}


// Optimized solution to the same problem (faster):
#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\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

using namespace std;

long long N,A,x;

long long dp[300][8000],ans;

int main(){

	dp[0][0]=1;

	scanf("%lld%lld",&N,&A);

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

		scanf("%lld",&x);

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

			for(int k=A*N;k>=x;k--){

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

			}

		}

	}

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

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

	}

	printf("%lld",ans);

	return 0;

}

// Optimized solution to the same problem (faster):
#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\n",ans);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long int ll;



#define EPS (1e-7)

#define INF (1e9)

#define PI (acos(-1))

#define MOD (1000000007)

int dx[4] = {1, 0, -1, 0};

int dy[4] = {0, 1, 0, -1};



int n, a;

vector<int> x;

ll dp[51][51][3010];



void input(){

    cin >> n >> a;

    x.resize(n);

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

}



int main()

{

    cin.tie(0);

    ios::sync_with_stdio(false);

    input();



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



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

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

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

                if(dp[i][j][k]){

                    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;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

template <class T>

inline bool chmax(T &a, T b)

{

    if (a < b)

    {

        a = b;

        return 1;

    }

    return 0;

}

template <class T>

inline bool chmin(T &a, T b)

{

    if (a > b)

    {

        a = b;

        return 1;

    }

    return 0;

}

typedef long long int ll;



#define ALL(v) (v).begin(), (v).end()

#define RALL(v) (v).rbegin(), (v).rend()

#define endl "\n"

const double EPS = 1e-7;

const int INF = 1 << 30;

const ll LLINF = 1LL << 60;

const double PI = acos(-1);

const int MOD = 1000000007;

const int dx[4] = {1, 0, -1, 0};

const int dy[4] = {0, 1, 0, -1};



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



// dp[i][j]:=i枚目まで見た時に、和がjとなるような場合の数

using P = pair<ll, ll>;



int main()

{

    cin.tie(0);

    ios::sync_with_stdio(false);

    int n, a;

    cin >> n >> a;

    vector<int> x(n);

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

    {

        cin >> x[i];

        x[i] -= a;

    }

    map<P, ll> dp;

    set<ll> se;

    queue<ll> que;

    se.insert(0);

    dp[P(0, 0)] = 1;

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

    {

        for (auto j : se)

        {

            if (!dp[P(i, j + x[i])])

            {

                que.push(j + x[i]);

            }

            dp[P(i + 1, j + x[i])] += dp[P(i, j)];

            dp[P(i + 1, j)] += dp[P(i, j)];

        }

        while (que.size())

        {

            auto tmp = que.front();

            que.pop();

            se.insert(tmp);

        }

    }

    cout << dp[P(n, 0)] - 1 << endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define ll long long



int x[55];

ll	dp[55][55][2700];

int main() {



	int n, a;

	cin>>n>>a;

	

	for(int i=1; i<=n; i++) cin>>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<=n; j++){

			for(int s=1; s<=2600 ; s++){

				 if(j==1 && x[i]==s) dp[i][j][s]=1LL;

				 if(x[i]>s) dp[i][j][s]=dp[i-1][j][s];

				else if(s>=x[i]) dp[i][j][s] = dp[i-1][j-1][s-x[i]] + dp[i-1][j][s];

				else dp[i][j][s]=0;

				}

			

			}

		

		}

	

	 ll ans=0LL;	

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

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

		}	

		

		cout<<ans<<endl;

		

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

		//for(int j=0; j<=n; j++)

			//for(int s=0; s<=30 ; s++){

				

				//cout<<i<<" "<<j<<" "<<s<<" "<<dp[i][j][s]<<endl;

				//}

	

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



#define ll long long



int x[55];

ll	dp[55][55][2700];

int main() {



	int n, a;

	cin>>n>>a;

	

	for(int i=1; i<=n; i++) cin>>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 s=1; s<=2600 ; s++){

				 if(j==1 && x[i]==s) dp[i][j][s]=1LL;

				 if(x[i]>s) dp[i][j][s]=dp[i-1][j][s];

				else if(s>=x[i]) dp[i][j][s] = dp[i-1][j-1][s-x[i]] + dp[i-1][j][s];



				}

			

			}

		

		}

	

	 ll ans=0LL;	

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

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

		}	

		

		cout<<ans<<endl;

		

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

		//for(int j=0; j<=n; j++)

			//for(int s=0; s<=30 ; s++){

				

				//cout<<i<<" "<<j<<" "<<s<<" "<<dp[i][j][s]<<endl;

				//}

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

typedef long long ll;

typedef unsigned long long ull;

using namespace std;

#define pb push_back

int dy[]={0, 0, 1, -1, 1, 1, -1, -1};

int dx[]={1, -1, 0, 0, 1, -1, -1, 1};



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

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

#define REP(i,n) for (int i=0;i<(n);i++)

#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define mp make_pair

#define fi first

#define sc second

ll dp[51][2501][51];

ll  n,a;

int main(){

	cin >> n >> a;



	REP(i,2501) {

		REP(j,n+1)

		dp[0][i][j] = 0;

	}

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



	REP(i,n) {

		ll x;

		cin >> x;

		REP(j,2501) {

			REP(k,n + 1) {

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

				if(j + x < 2501 && k < n)

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

			}

		}

	}



	ll ans = 0;

	REP(j,2501) {

		REP(k,n + 1) {

			if(k > 0 && j % k == 0 && j / k == a)

				ans += dp[n][j][k];

		}

	}

	cout << ans << endl;



	return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;



long n,a,x[100];



long dp[3000][100];



int main(int argc, char const *argv[])

{

    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 j = a*n;j >= x[i];j--) {

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

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

            }

        }

    }    

    long ans = 0;

    for(int j = 0;j <= a*n;j++) {

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

            if(j % k == 0 && j / k == a)ans += dp[j][k];

        }

    }

    cout << ans << endl;

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

main()

{

	int n,A,x[50],i=0;

	long dp[51][5001]={};

	for(cin>>n>>A;i<n;x[i++]-=A)cin>>x[i];

	dp[0][n*A]=1;

	for(i=0;i<n;i++)for(int j=0;j<=2*n*A;j++)

	{

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

		if(j-x[i]>=0&&j-x[i]<=2*n*A)dp[i+1][j]+=dp[i][j-x[i]];

	}

	cout<<dp[n][n*A]-1<<endl;

}


// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

int n,a,x[55];

long dp[55][5555];

main()

{

	cin>>n>>a;

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

	dp[0][2500]=1;

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

	{

		x[i]-=a;

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

		{

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

			if(j<=5000-x[i])dp[i+1][j+x[i]]+=dp[i][j];

		}

	}

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

signed main() {

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, a;

	cin >> n >> a;

	long long dp[51][2501] = {};

	dp[0][0] = 1;

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

		int x;

		cin >> x;

		for (int j = 50; j >= 1; j--) {

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

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

			}

		}

	}

	long long ans = 0;

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

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

	}

	cout << ans << '\n';

	return 0;

}


// Optimized solution to the same problem (faster):
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

signed main() {

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

  int n, a;

  cin >> n >> a;

  long long dp[55][3300] = {};

  dp[0][0] = 1;

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

    int x;

    cin >> x;

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

      for (int k = 3000; k - x >= 0; k--) {

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

      }

    }

  }

  long long ans = 0;

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

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

  }

  cout << ans << endl;

  return 0;	

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



long dp[55][2525][55];



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    int n, a; cin >> n >> a;

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



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



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

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

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

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

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

            }

        }

    }



    long ans = 0;

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

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

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

        }

    }



    cout << ans << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

using namespace std;



long dp[5500];



int main() {

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

    int n, a; cin >> n >> a;

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



    dp[2500] = 1;

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

        if(x[i] >= 0) {

            for(int j=5000; j >= x[i]; --j) {

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

            }

        } else {

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

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

            }

        }

    }



    cout << dp[2500] - 1 << '\n';

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <map>

#include <bitset>

#include <iomanip>

#include <string>

#include <algorithm>

#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)

#define ALL(c) c.begin(),c.end()

#define PB push_back

#define INF 1100000000

#define LLINF 1100000000000000000

#define MOD 1000000007

#define FI first

#define SE second

#define MP make_pair



using namespace std;

typedef long long ll;



ll dp[60][60][2600];

int main()

{

  int N, A;

  cin >> N >> A;

  vector<int> x(N); REP(i, N) cin >> x[i];

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

  REP(i, N) {

    REP(j, N) {

      REP(k, 2501) {

        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][A*i];

  }

  cout << ans << endl;

  return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <map>

#include <bitset>

#include <iomanip>

#include <string>

#include <algorithm>

#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)

#define ALL(c) c.begin(),c.end()

#define PB push_back

#define INF 1100000000

#define LLINF 1100000000000000000

#define MOD 1000000007

#define FI first

#define SE second

#define MP make_pair



using namespace std;

typedef long long ll;



ll dp[60][5200];

constexpr int OFFSET = 2600;



int main()

{

  int N, A;

  cin >> N >> A;

  vector<int> x(N);

  REP(i, N) {

    cin >> x[i];

    x[i] -= A;

  }



  dp[0][OFFSET] = 1;

  REP(i, N) {

    REP(j, 5200) {

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

      if (0 <= j + x[i] && j + x[i] < 5200)

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

    }

  }



  cout << dp[N][OFFSET] - 1 << endl;

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int Mod=998244353;

long long fac[300005],inv[300005];

long long quipow(long long x,long long n)  

{

    long long res=1;

    while(n>0)

    {

        if(n&1) res=res*x%Mod;

        x=x*x%Mod;

        n>>=1;

    }

    return res;

}

int main()

{

	int n;long long k,A,B,ans=0;

	fac[0]=fac[1]=1;

	for(int i=2;i<=300000;i++)fac[i]=fac[i-1]*i%Mod;

	inv[300000]=quipow(fac[300000],Mod-2);

	for(int i=299999;i>=0;i--)inv[i]=inv[i+1]*(i+1)%Mod;

	scanf("%d%lld%lld%lld",&n,&A,&B,&k);

	for(int i=0;i<=n&&i*A<=k;i++)

	{

		if((k-i*A)%B) continue;

		int j=(int)((k-i*A)/B);

		if(j>n) continue;

		ans=(ans+1ll*fac[n]*fac[n]%Mod*inv[i]%Mod*inv[j]%Mod*inv[n-i]%Mod*inv[n-j]%Mod)%Mod;

	}

	printf("%lld",ans);

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



long long mod=998244353;

long long fact[300010];

long long res[300010];

long long poww(long long x,long long n)

{

	if(n==0) return 1;

	else if(n==1) return x;

	else

	{

		long long sum=poww(x,n/2);

		sum=sum*sum;

		sum=sum%mod;

		if(n%2!=0)

		sum=sum*x;

		sum=sum%mod;

		return sum;

	}

}

long long C(long long k,long long n)

{

	return (((fact[n]*res[k]) % mod) * res[n-k]) % mod;

}

int main()

{

	ios_base::sync_with_stdio(0);

	cin.tie(0);

	cout.tie(0);

	long long n,a,b,k;

	cin >> n >> a >> b >> k;

	fact[0]=1,res[0]=1;

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

	{

		fact[i]=fact[i-1]*i;

		fact[i]=fact[i]%mod;

		res[i]=poww(fact[i],mod-2);

		res[i]=res[i]%mod;

	}

	long long ans=0;

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

	{

		if((k-a*i)%b==0 && (k-a*i)>=0)

		{

			long long t=(k-a*i)/b;

			if(t<=n)

			{

			ans+=(C(t,n) * C(i,n))%mod;

			ans=ans%mod;

		    }

		}

	}

	cout << ans << "\n";

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#define ll long long

#define clz 998244353

ll a,b,k;

ll fac[300010];

ll ca[300010],cb[300010];

int n,p;

ll inv(ll x){ 

    if(x==1) return 1;  

    return (clz-clz/x)*inv(clz%x)%clz;  

}

ll C(ll n,ll m){

	ll x=(fac[m]*fac[n-m])%clz;

	return (fac[n]*inv(x))%clz;

}

int main(){

	fac[0]=fac[1]=1ll;

	for(int i=2;i<=300001;i++) fac[i]=(fac[i-1]*i)%clz;

	scanf("%d%lld%lld%lld",&n,&a,&b,&k);

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

		if(k-i*a>=0&&(k-i*a)%b==0&&(k-i*a)/b<=n){

			ca[++p]=i;

			cb[p]=(k-i*a)/b; 

		}

	}

	ll ans=0;

	for(int i=1;i<=p;i++) ans=(ans+C(n,ca[i])*C(n,cb[i])%clz)%clz;

	printf("%lld",ans);

	return 0;

} 

// Optimized solution to the same problem (faster):
#include<cstdio>

#define Mod 998244353

int gcd(int x,int y){return y?gcd(y,x%y):x;}

int n,a,b;

long long sum,k,t,inv[300100],C[300100];

int main(){

	scanf("%d%d%d%lld",&n,&a,&b,&k);

	inv[1]=1;for(int i=2;i<=n;++i)inv[i]=(Mod-Mod/i)*inv[Mod%i]%Mod;

	C[0]=1;for(int i=1;i<=n;++i)C[i]=C[i-1]*(n-i+1)%Mod*inv[i]%Mod;

	t=gcd(a,b);a/=t;b/=t;

	if(k%t!=0){puts("0");return 0;}else k/=t;

	for(long long i=0;i<=b;++i)if((k-a*i)%b==0){t=i;break;}

	for(long long i=t;i*a<=k&&i<=n;i+=b){

		if((k-i*a)/b<=n)sum=(sum+C[i]*C[(k-i*a)/b])%Mod;

	}

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

	return 0;

}

// Fastest known solution for this problem: