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

//#include<stdlib.h>

//#include<string.h>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N=55;

const ll MOD=1e9+7;

int main()

{

    int n;

    int a;

//for(auto &a:b)

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

    cin>>n>>a;

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

    int p;

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

    b[0][0]=1;

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

    {

        cin>>p;

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

        {

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

            {

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

            }

        }

    }

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

    {

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

    }

    cout<<cnt<<endl;

    return 0;

}

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



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

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

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

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

#define ll long long

#define ff first

#define ss second

#define vi vector<int>

#define ii pair<int, int>

#define vii vector<ii>

#define pii pair<int, ii>

#define maxN 105

#define oo 1000000007

#define mp make_pair

#define pb push_back

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

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

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

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



using namespace std;



int n, A;

int a[maxN];

ll f[maxN][maxN*maxN];



int main() {

//    #ifndef ONLINE_JUDGE

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

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

//    #endif



    scii(n, A);

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

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

//    fto(i, 1, n) {

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

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

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

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

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

//            }

//            bug2(i, j);

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

//        }

//    }

    int M = 2500;

    f[0][M] = 1;

    fto(i, 1, n) {

        fto(j, -M, M) {

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

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

//            bug2(i, j+M);

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

        }

    }

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

    return 0;

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

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

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

#define ll long long

using namespace std;

const int N=55,M=2510;

int a[N];

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



int main(){

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

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

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

	int nw=0;

	fr(i,1,n){

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

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

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

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

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

		}

		nw^=1;

	}

	ll ans=0;

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

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

	return 0;

}

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



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

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

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

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

#define ll long long

#define ff first

#define ss second

#define vi vector<int>

#define ii pair<int, int>

#define vii vector<ii>

#define pii pair<int, ii>

#define maxN 105

#define oo 1000000007

#define mp make_pair

#define pb push_back

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

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

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

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



using namespace std;



int n, A;

int a[maxN];

ll f[maxN][maxN*maxN];



int main() {

//    #ifndef ONLINE_JUDGE

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

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

//    #endif



    scii(n, A);

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

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

//    fto(i, 1, n) {

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

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

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

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

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

//            }

//            bug2(i, j);

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

//        }

//    }

    int M = 2500;

    f[0][M] = 1;

    fto(i, 1, n) {

        fto(j, -M, M) {

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

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

//            bug2(i, j+M);

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

        }

    }

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

    return 0;

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

#include <cstdio>

using namespace std;

long long n, x, s, a[55], d[55][55][2505]={1};

int main() {

	int i, j, k;

	cin>>n>>x;

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

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

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

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

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

		}

	}

	for(j=1; j<=n; j++) s += d[n][j][j*x];

	cout<<s;

	return 0;

}

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

long long d[55][5005];

int main() {

	int i, j, n, a, x, z=0;

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

	d[0][2500] = 1;

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

		scanf("%d", &x);

		x -= a;

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

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

			d[i][j+x] += d[i-1][j];

		}

	}

	printf("%lld", d[n][2500]-1);

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

#include <cstdio>

using namespace std;

long long n, x, s, a[55], d[55][55][2505]={1};

int main() {

	int i, j, k;

	cin>>n>>x;

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

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

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

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

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

		}

	}

	for(j=1; j<=n; j++) s += d[n][j][j*x];

	cout<<s;

	return 0;

}

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

long long n, a, x, d[55][5005];

int C=2500;

int main() {

	int i, j;

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

	d[0][C] = 1;

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

		scanf("%lld", &x);

		x -= a;

		for(j=0; j<=2*C; j++) {

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

			d[i][j+x] += d[i-1][j];

		}

	}

	printf("%lld", d[n][C]-1);

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

#include <cstdio>

using namespace std;

long long n, x, s, a[55], d[55][55][2505]={1};

int main() {

	int i, j, k;

	cin>>n>>x;

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

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

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

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

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

		}

	}

	for(j=1; j<=n; j++) s += d[n][j][j*x];

	cout<<s;

	return 0;

}

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

long long n, a, x, z, C=2500, d[2][5005];

int main() {

	int i, j;

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

	d[0][C] = 1;

	for(i=0; i<n; i++, z^=1) {

		scanf("%lld", &x);

		x -= a;

		for(j=0; j<=5000; j++) d[z^1][j] = 0;

		for(j=0; j<=2*C; j++) {

			if(d[z][j]) {

				d[z^1][j] += d[z][j];

				d[z^1][j+x] += d[z][j];

			}

		}

	}

	printf("%lld", d[z][C]-1);

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

long long d[55][5005];

int main() {

	int i, j, n, a, x, z=0;

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

	d[0][2500] = 1;

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

		scanf("%d", &x);

		x -= a;

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

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

			d[i][j+x] += d[i-1][j];

		}

	}

	printf("%lld", d[n][2500]-1);

}


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

long long n, a, x, z, C=2500, d[2][5005];

int main() {

	int i, j;

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

	d[0][C] = 1;

	for(i=0; i<n; i++, z^=1) {

		scanf("%lld", &x);

		x -= a;

		for(j=0; j<=5000; j++) d[z^1][j] = 0;

		for(j=0; j<=2*C; j++) {

			if(d[z][j]) {

				d[z^1][j] += d[z][j];

				d[z^1][j+x] += d[z][j];

			}

		}

	}

	printf("%lld", d[z][C]-1);

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

long long n, a, x, d[55][5005];

int C=2500;

int main() {

	int i, j;

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

	d[0][C] = 1;

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

		scanf("%lld", &x);

		x -= a;

		for(j=0; j<=2*C; j++) {

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

			d[i][j+x] += d[i-1][j];

		}

	}

	printf("%lld", d[n][C]-1);

}

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

long long n, a, x, z, C=2500, d[2][5005];

int main() {

	int i, j;

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

	d[0][C] = 1;

	for(i=0; i<n; i++, z^=1) {

		scanf("%lld", &x);

		x -= a;

		for(j=0; j<=5000; j++) d[z^1][j] = 0;

		for(j=0; j<=2*C; j++) {

			if(d[z][j]) {

				d[z^1][j] += d[z][j];

				d[z^1][j+x] += d[z][j];

			}

		}

	}

	printf("%lld", d[z][C]-1);

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

#include <queue>

#include <stack>

#include <vector>

#include <sstream>

#include <algorithm>

#include <deque>

#include <set>

#include <map>

#include <unordered_set>

#include <unordered_map>

#include <list>

#include <cstdio>

#include <iostream>

#include <cmath>

#include <climits>

#include <bitset>

#include <functional>

#include <numeric>

#include <ctime>

#include <cassert>

#include <cstring>

#include <fstream>



using namespace std;





long long dp[51][5001];



int main() {



    int n, a;

    cin >> n >> a;

    vector<int> x(n);

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

        cin >> x[i];

    }



    sort(x.begin(), x.end());

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

        x[i] -= a;

    }

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

    dp[0][2500] = 1;

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

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

            if (k - x[i - 1] >= 0 && k - x[i - 1] < 5001)

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

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

        }

    }

    long long sumx = 0;

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

        sumx += dp[i][2500];

    }

    cout << sumx << endl;









    return 0;

}

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

#include <queue>

#include <stack>

#include <vector>

#include <sstream>

#include <algorithm>

#include <deque>

#include <set>

#include <map>

#include <unordered_set>

#include <unordered_map>

#include <list>

#include <cstdio>

#include <iostream>

#include <cmath>

#include <climits>

#include <bitset>

#include <functional>

#include <numeric>

#include <ctime>

#include <cassert>

#include <cstring>

#include <fstream>

#include <iomanip>



using namespace std;



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

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

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

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



using ll = long long;

using pii = pair<int, int>;

using pll = pair<ll, ll>;



template<class T>

void print_container(T &container, string delim=" ") {

    bool first = true;

    for(auto &t: container){

        if(!first){

            cout << delim;

        }

        first = false;

        cout << t;

    }

    cout << endl;

}



int main() {

    int n, a;

    cin >> n >> a;

    vector<int> x(n);

    REP(i, n){

        cin >> x[i];

        x[i] -= a;

    }



    sort(x.begin(), x.end());



    vector<vector<ll>> dp(n+1, vector<ll>(5001, 0));



    dp[0][2500] = 1;

    IFOR(i, 1, n){

        RFOR(j, 5000, 0){

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

        }

    }



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



    return 0;

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

using namespace std;

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

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

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

#define MP(a,b) make_pair(a,b)

typedef long long LL;

typedef pair<int, int> PI;

typedef pair<LL, LL> PLL;

typedef vector<int> VI;

const LL MOD = 1000000007LL;

LL dp[50][51][2501];

int x[50];

int main() {

	int N, A;

	cin >> N >> A;

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

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

	REP(i, 1, N) {

		rep(j, 51) {

			rep(k, 2501) {

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

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

			}

		}

	}

	LL ans = 0;

	REP(i, 1, N + 1) {

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

	}

	cout << ans << endl;

}

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

using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;

const ll INF = 1LL << 60;

const double PI = 3.141592653589793238;

const double EPS = 1e-10;

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

int x[50];

int main() {

	int N, A;

	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 <= i; j++) {

			for (int k = 0; k <= 50 * 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;

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

using namespace std;

typedef long long ll;

typedef long double ld;

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

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

#define FOR(i, m, n) for (int i = m; i < n; ++i)

#define FORR(i, m, n) for (int i = m; i >= n; --i)

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

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

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

const ll INF=1LL<<60;

const int inf=(1<<30)-1;

const int mod=1e9+7;

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

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

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];

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

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

	REP(i,n){

		REP(j,n){

			REP(k,2501){

				if(!dp[i][j][k]) 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(i,1,n+1){

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

	}

	cout << ans << endl;

}

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

using namespace std;

typedef long long ll;

typedef long double ld;

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

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

#define FOR(i, m, n) for (int i = m; i < n; ++i)

#define FORR(i, m, n) for (int i = m; i >= n; --i)

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

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

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

const ll INF=1LL<<60;

const int inf=(1<<30)-1;

const int mod=1e9+7;

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

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

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+1][n+1][2501]={};

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

	REP(i,n){

		REP(j,n){

			REP(k,2501){

				if(!dp[i][j][k]) 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(i,1,n+1){

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

	}

	cout << ans << endl;

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

using namespace std;

#define int long long



int dp[51][51][2501];

//i枚目までのカードでj枚選んで合計がkになる組み合わせ



signed 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];

  }



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

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

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

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

        //カードを使わない場合

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

        //カードを使う場合

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

      }

    }

  }



  int ans = 0;

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

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

  }

  cout << ans << endl;



  return 0;

}


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

using namespace std;

#define int long long



int dp[51][5001];

//i枚目までのカードで合計がkになる組み合わせ



signed 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;

  }

  //平均がa <==> x[i]-aの合計が0



  int base = n*a/2;

  dp[0][base] = 1;

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

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

      if(0 <= k+x[i] && k+x[i] <= 5000){

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

      }

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

    }

  }

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



  return 0;

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

#include <algorithm>

#include <string>

#include <vector>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <cstdio>



using namespace std;



typedef unsigned long long u64;

typedef vector<int> vi;

typedef vector<u64> vy;

typedef vector<vy> vvy;

typedef vector<vvy> vvvy;



vi x;

vvvy dp;

unsigned int N, A;



u64 rec(unsigned int i, unsigned int cur, int num, vvvy &dp, vi &x) {

    if (dp[i][cur][num] < (1ull<<57)) {

        return dp[i][cur][num];

    }





    if (i == N) {

        return dp[i][cur][num] = 0;

    } else if (A*N < cur) {

        return dp[i][cur][num] = 0;

    }



    u64 res=0;

    if (A*(num+1) == cur+x[i]) res++;



    res += rec(i+1, cur, num, dp, x);

    res += rec(i+1, cur+x[i], num+1, dp, x);



    return dp[i][cur][num] = res;

}



int main(void) {

    cin >> N >> A;



    x = vi(N);

    unsigned int i;

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

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

    }



    sort(x.begin(), x.end());

    vvvy dp(N+1, vvy(50*50+1, vy(N+1, 1ull<<58)));

    cout << rec(0, 0, 0, dp, x) << endl;



    return 0;

}


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

#include <algorithm>

#include <vector>

#include <cstdio>



using namespace std;



typedef long long i64;

typedef vector<i64> vx;

typedef vector<vx> vvx;



i64 numways_makeave(const vx &cards, i64 ave) {

    int n=cards.size();

    i64 x=ave;

    vx y(n);

    int i;

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

        y[i] = cards[i] - ave;

        if (cards[i] > x)

            x = cards[i];

    }



    vvx dp(2, vx(2*n*x+1));

    int j, t;

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

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

        for (t=0; t<=2*n*x; t++)

            if (t-y[j-1]>=0 && t-y[j-1]<=2*n*x) {

                dp[j&1][t] = dp[j&1^1][t] + dp[j&1^1][t-y[j-1]];

            } else {

                dp[j&1][t] = dp[j&1^1][t];

            }



    return dp[n&1][n*x] - 1LL;

}



int main(void) {

    int n;

    i64 a;

    cin >> n >> a;



    vx x(n);

    int i;

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

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

    }



    cout << numways_makeave(x, a) << endl;

    return 0;

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

#include <cstring>

#include <algorithm>

using namespace std;

typedef long long LL;

const int maxn=52;

int n,k;

int a[maxn],sum[maxn];

LL dp[3][maxn][maxn*maxn];



int main() {

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

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

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

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

    int now=0;

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

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

            for (int k=0;k<=sum[i];k++) {

                dp[now][j][k]=dp[now^1][j][k];

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

            }

        now^=1;

    }



    LL ans=0;

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

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

    return 0;

}


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

using namespace std;

const int N=55;

long long dp[N][N*N];      //dp值会爆int

int main()

{

    int n,a;

    cin>>n>>a;

    dp[0][0]=1;

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

    {

        int x;

        cin>>x;

        for(int j=i-1;j>=0;j--)    //每一次个数向下减少

            for(int k=0;k<=N*j;k++)    //优化时间  由于k最大为N*j次

                dp[j+1][k+x]+=dp[j][k];       //个数加1 则找到前面个数的值相加

    }

    long long ans=0;       

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

            ans+=dp[i][i*a];    //累计所有个数会出现平均值满足a的情况

    cout<<ans<<endl;

    return 0;

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

#include <cstring>

#include <algorithm>

using namespace std;

typedef long long LL;

const int maxn=52;

int n,k;

int a[maxn],sum[maxn];

LL dp[3][maxn][maxn*maxn];



int main() {

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

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

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

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

    int now=0;

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

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

            for (int k=0;k<=sum[i];k++) {

                dp[now][j][k]=dp[now^1][j][k];

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

            }

        now^=1;

    }



    LL ans=0;

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

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

    return 0;

}


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

#include<cstdio>

typedef long long ll;

using namespace std;



int a[55];

int sum[55];

ll dp[55][2505];



int main()

{

    int n,A;

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

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

    dp[0][0]=1;

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

        for(int i=k;i>=1;i--){

            for(int j=sum[k];j>=a[k];j--){

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

            }

        }

    }

    ll ans=0;

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

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

    return 0;

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

#include <cstring>

#include <algorithm>

using namespace std;

typedef long long LL;

const int maxn=52;

int n,k;

int a[maxn],sum[maxn];

LL dp[3][maxn][maxn*maxn];



int main() {

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

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

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

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

    int now=0;

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

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

            for (int k=0;k<=sum[i];k++) {

                dp[now][j][k]=dp[now^1][j][k];

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

            }

        now^=1;

    }



    LL ans=0;

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

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

    return 0;

}


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

#include<cstring>

long long arr[55];

long long dp[55][2505];

int main()

{

    int N,A;

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

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

    {

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

    }

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

    dp[0][0]=1;

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

    {

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

        {

            for(int j=arr[i-1]; j<=2500; j++)

            {

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

            }

        }

    }

    long long sum=0;

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

    {

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

    }

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

    return 0;

}