stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.167136837607919x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.166701798377715x):
#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++){

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

        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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.982998317029199x):
#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];

    x[i]-=a;

  }

  ll dp[n+10][5000]={};

  dp[0][2500]=1;

  

  rep(i,n){

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

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

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

    }

  }

  ll res = dp[n][2500]-1;

  cout << res << endl;

  return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.024190422624123x):
#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];

    x[i]-=a;

  }

  ll dp[n+10][5000]={};

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

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

    }

  }

  ll res = dp[n][2500]-1;

  cout << res << endl;

  return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.6618257084593644x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.2567316721423984x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.240644315360417x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.141027206493741x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1070840679801297x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.1039696628180882x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.1335827247658403x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.5585129763417465x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.1742675527023059x):
#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;	

}