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

#include <algorithm>

#include <cstdio>

#include <cstdlib>

#include <sstream>

#include <cstring>

#include <string>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <numeric>

#include <functional>

#include <cmath>

#include <array>



#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)

#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)

#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)

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

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



using namespace std;

typedef long long ll; typedef vector<int> VI;

typedef pair<int,int> pii;

const int mod = (int)1e9+7;



ll cp[2520][52], nx[2520][52];



int main()

{

	

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

	int n, a;

	cin >>n >>a;

	VI x(n);

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

	

	memset(cp, 0, sizeof cp);

	cp[0][0]=1;

	

	rep(i, n){

		memset(nx, 0, sizeof nx);

		rep(j, a*n) rep(k,n) {

			nx[j][k] += cp[j][k];

			if( j+x[i] <= a*n ) nx[j+x[i]][k+1] += cp[j][k];

		}

		swap(cp, nx);

	}

	

	ll ans =0;

	rep(i, a*n+1) rep2(j,1,n+1){

		if(i==j*a){

			ans += cp[i][j];

			//printf("%d:%d:%lld  ",i,j,cp[i][j]);

		}

	}

	cout << ans <<endl;

	

	return 0;

}


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

#include <algorithm>

#include <cstdio>

#include <cstdlib>

#include <sstream>

#include <cstring>

#include <string>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <numeric>

#include <functional>

#include <cmath>

#include <array>

 

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)

#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)

#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)

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

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

 

using namespace std;

typedef long long ll; typedef vector<int> VI;

typedef pair<int,int> pii;

const int mod = (int)1e9+7;





int main()

{

	

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

	int n, a;

	cin >>n >>a;

	VI x(n);

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

	int smp=0, smm=0;

	rep(i,n){ if(a-x[i]<0) smm += a-x[i]; else smp += a-x[i];}

	int KJ =  max(abs(smp), abs(smm)) + 100;

	vector<ll> cp( KJ*2, 0);

	cp[KJ] = 1;

	auto np = cp;

	rep(i, n){

		rep2(j, KJ + smm - 2,  KJ + smp + 2) if(cp[j]>0){

			np[j + a -x[i]] += cp[j];

		}

		cp = np;

	}

	

	cout << cp[KJ] - 1 <<endl;

	return 0;

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

#include <algorithm>

#include <cstdio>

#include <cstdlib>

#include <sstream>

#include <cstring>

#include <string>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <numeric>

#include <functional>

#include <cmath>

#include <array>

 

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)

#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)

#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)

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

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

 

using namespace std;

typedef long long ll; typedef vector<int> VI;

typedef pair<int,int> pii;

const int mod = (int)1e9+7;



const int KJ = 3000;



int main()

{

	

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

	int n, a;

	cin >>n >>a;

	VI x(n);

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

	

	vector<ll> cp( KJ*2, 0);

	cp[KJ] = 1;

	auto np = cp;

	rep(i, n){

		rep2(j, KJ-a*n,  KJ +a*n+2) if(cp[j]>0){

			np[j + a -x[i]] += cp[j];

		}

		cp = np;

	}

	

	cout << cp[KJ] - 1 <<endl;

	

	return 0;

}

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

#include <algorithm>

#include <cstdio>

#include <cstdlib>

#include <sstream>

#include <cstring>

#include <string>

#include <vector>

#include <set>

#include <map>

#include <queue>

#include <numeric>

#include <functional>

#include <cmath>

#include <array>

 

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)

#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)

#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)

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

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

 

using namespace std;

typedef long long ll; typedef vector<int> VI;

typedef pair<int,int> pii;

const int mod = (int)1e9+7;





int main()

{

	

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

	int n, a;

	cin >>n >>a;

	VI x(n);

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

	int smp=0, smm=0;

	rep(i,n){ if(a-x[i]<0) smm += a-x[i]; else smp += a-x[i];}

	int KJ =  max(abs(smp), abs(smm)) + 100;

	vector<ll> cp( KJ*2, 0);

	cp[KJ] = 1;

	auto np = cp;

	rep(i, n){

		rep2(j, KJ + smm - 2,  KJ + smp + 2) if(cp[j]>0){

			np[j + a -x[i]] += cp[j];

		}

		cp = np;

	}

	

	cout << cp[KJ] - 1 <<endl;

	return 0;

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



using namespace std;



#ifdef LOCAL

#define eprintf(...) fprintf(stderr, __VA_ARGS__)

#else

#define eprintf(...) 42

#endif



const int N = 55;



int a[N];

long long f[N][N][N * N];



int main() {

#ifdef LOCAL

  freopen("input.txt", "r", stdin);

  freopen("output.txt", "w", stdout);

#endif

  int n, A;

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

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

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

  }

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

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

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

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

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

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

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

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

  }

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

  return 0;

}

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

#define int long long

using namespace std;

int t,n;

int a[51];

int f[51][2501];

//int f[101][101];

int32_t main()

{

    cin>>n>>t;

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

        cin>>a[i];

    int res=0;

    int sum=0;

    f[0][0]=1;

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

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

            {

                //cerr<<j<<endl;

                for(int k=2500;k>=a[i];k--)

                {

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

                }

            }

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

    {

        res+=f[i][t*i];

    }

    cout<<res;

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

#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

typedef long long LL;

const int N=57;

LL d[N][N*N],lazy[N][N*N],n,a,c;

int main(){

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

    memset(d,0,sizeof(d));

    memset(lazy,0,sizeof(lazy));

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

        scanf("%lld",&c);

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

        for(int k=1;k<N*N;k++)

        if(d[j][k]){

            lazy[j+1][k+c]+=d[j][k];

        }

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

        for(int k=1;k<N*N;k++)

        if(lazy[j][k]){

            d[j][k]+=lazy[j][k];

            lazy[j][k]=0;

        }

        d[1][c]++;

    }

    LL ans=0;

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

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

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

    return 0;

}


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

using namespace std;



const int N = 5500;



long long dp[55][N];



int main() {

	

	ios::sync_with_stdio(0);

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

	

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

			for (int s = N - 1; s >= 0; s--) if (dp[j - 1][s]) {

				if (s + x < N) dp[j][s + x] += dp[j - 1][s];

			}

		}

	}

	

	long long ans = 0;

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

	cout << ans << "\n";

	

	return 0;

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

#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

typedef long long LL;

const int N=57;

LL d[N][N*N],lazy[N][N*N],n,a,c;

int main(){

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

    memset(d,0,sizeof(d));

    memset(lazy,0,sizeof(lazy));

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

        scanf("%lld",&c);

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

        for(int k=1;k<N*N;k++)

        if(d[j][k]){

            lazy[j+1][k+c]+=d[j][k];

        }

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

        for(int k=1;k<N*N;k++)

        if(lazy[j][k]){

            d[j][k]+=lazy[j][k];

            lazy[j][k]=0;

        }

        d[1][c]++;

    }

    LL ans=0;

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

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

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

    return 0;

}


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

#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 sci(a) scanf("%d", &a)

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

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

#define pb(a) push_back(a)

#define oo 1000000007

#define maxN 55

using namespace std;

int n, k, a[maxN];

long long f[55][55][55*55];





int main() {

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

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

    scii(n, k);

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

    long long res = 0;

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

    fto(i, 0, n) {

        fto(j, 0, i) {

            fto(s, 0, 55*55) {

                if(f[i][j][s]) {

                    f[i+1][j+1][s+a[i+1]] += f[i][j][s];

                    f[i+1][j][s] += f[i][j][s];

                }

            }

        }

    }

    fto(j, 1, n) {

        fto(s, 1, 55*55) {

            if(f[n][j][s] > 0 && s == j*k) {

                res += f[n][j][s];

            }

        }

    }

    

    cout << res << endl;

    return 0;

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

#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

typedef long long LL;

const int N=57;

LL d[N][N*N],lazy[N][N*N],n,a,c;

int main(){

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

    memset(d,0,sizeof(d));

    memset(lazy,0,sizeof(lazy));

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

        scanf("%lld",&c);

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

        for(int k=1;k<N*N;k++)

        if(d[j][k]){

            lazy[j+1][k+c]+=d[j][k];

        }

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

        for(int k=1;k<N*N;k++)

        if(lazy[j][k]){

            d[j][k]+=lazy[j][k];

            lazy[j][k]=0;

        }

        d[1][c]++;

    }

    LL ans=0;

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

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

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

    return 0;

}


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

using namespace std;

typedef long long LL;

LL dp[55][5005];

int main(){

    int n, a, x;

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

    dp[0][2500] = 1;

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

        scanf("%d", &x);

        for(int j=0;j<=5000;j++) dp[i][j+x-a] += dp[i-1][j], dp[i][j] += dp[i-1][j];

    }

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

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

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

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

#define PB push_back

#define EB emplace_back

#define MP make_pair

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

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

#define debug(x) cerr << #x << ": " << x << endl

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

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



/* -----  2018/02/14  Problem: 060_arc_a / Link: https://arc060.contest.atcoder.jp/tasks/arc060_a?lang=en  ----- */

/* ------問題------







-----問題ここまで----- */

/* -----解説等-----







----解説ここまで---- */



LL N, A;



LL ans = 0LL;



int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	cin >> N >> A;

	VI a(N);

	FOR(i, 0, N) {

		cin >> a[i];

	}

	vector<VVL> dp(N + 1, VVL(N + 1, VL(2501, 0)));

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

	FOR(i, 0, N) {

		FOR(k, 0, N) {

			FOR(val, 0, 2501) {

				if(val+a[i]<=2500)dp[i + 1][k + 1][val + a[i]] += dp[i][k][val];

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

			}

		}

	}

	FOR(i, 1, N+1) {

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

	}



	cout << ans << "\n";



	return 0;

}


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

using namespace std;

typedef double db;

typedef long long ll;

typedef vector<int> vi;

typedef pair<int, int> pii;

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pw(x) (1ll << (x))

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

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

#define rep(i,l,r) for(int i=(l);i<(r);++i)

#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)

#define dd(x) cout << #x << " = " << x << ", "

#define de(x) cout << #x << " = " << x << endl



//-----

const int N = 50 + 6, B = 2500;

int n, a, x[N];

ll dp[N][N * 100];

int main() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

  cin >> n >> a;

  rep(i, 1, n + 1) cin >> x[i], x[i] -= a;

  dp[0][B + 0] = 1;

  rep(i, 0, n + 1) rep(j, 0, 2 * B) if (dp[i][j]) {

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

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

	}

	cout << dp[n][B] - 1;

	return 0;

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

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

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

#define PB push_back

#define EB emplace_back

#define MP make_pair

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

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

#define debug(x) cerr << #x << ": " << x << endl

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

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



/* -----  2018/02/14  Problem: 060_arc_a / Link: https://arc060.contest.atcoder.jp/tasks/arc060_a?lang=en  ----- */

/* ------問題------







-----問題ここまで----- */

/* -----解説等-----







----解説ここまで---- */



LL N, A;



LL ans = 0LL;



int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	cin >> N >> A;

	VI a(N);

	FOR(i, 0, N) {

		cin >> a[i];

	}

	vector<VVL> dp(N + 1, VVL(N + 1, VL(2501, 0)));

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

	FOR(i, 0, N) {

		FOR(k, 0, N) {

			FOR(val, 0, 2501) {

				if(val+a[i]<=2500)dp[i + 1][k + 1][val + a[i]] += dp[i][k][val];

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

			}

		}

	}

	FOR(i, 1, N+1) {

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

	}



	cout << ans << "\n";



	return 0;

}


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

#include<cstring>

#include<cstdlib>

#include<algorithm>

#define ll long long

using namespace std;

const int mn = 55, ms = 2600;

ll a[mn], s[mn], f[mn][mn][ms];

int main()

{

	int n, m, i, j, k;

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

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

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

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

	for(i = 2; i <= n; i++)

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

			for(k = s[i]; k >= 0; k--)

			{

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

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

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

			}

	ll ans = 0;

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

		for(k = 0; k <= s[n]; k++)

			if(k % j == 0 && k / j == m)

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

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

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

using namespace std;

typedef double db;

typedef long long ll;

typedef vector<int> vi;

typedef pair<int, int> pii;

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pw(x) (1ll << (x))

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

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

#define rep(i,l,r) for(int i=(l);i<(r);++i)

#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)

#define dd(x) cout << #x << " = " << x << ", "

#define de(x) cout << #x << " = " << x << endl



//-----

const int N = 50 + 6, B = 2500;

int n, a, x[N];

ll dp[N][N * 100];

int main() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

  cin >> n >> a;

  rep(i, 1, n + 1) cin >> x[i], x[i] -= a;

  dp[0][B + 0] = 1;

  rep(i, 0, n + 1) rep(j, 0, 2 * B) if (dp[i][j]) {

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

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

	}

	cout << dp[n][B] - 1;

	return 0;

}

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

#include<cstring>

#include<cstdlib>

#include<algorithm>

#define ll long long

using namespace std;

const int mn = 55, ms = 2600;

ll a[mn], s[mn], f[mn][mn][ms];

int main()

{

	int n, m, i, j, k;

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

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

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

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

	for(i = 2; i <= n; i++)

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

			for(k = s[i]; k >= 0; k--)

			{

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

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

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

			}

	ll ans = 0;

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

		for(k = 0; k <= s[n]; k++)

			if(k % j == 0 && k / j == m)

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

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

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

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

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

#define PB push_back

#define EB emplace_back

#define MP make_pair

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

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

#define debug(x) cerr << #x << ": " << x << endl

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

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



/* -----  2018/02/14  Problem: 060_arc_a / Link: https://arc060.contest.atcoder.jp/tasks/arc060_a?lang=en  ----- */

/* ------問題------







-----問題ここまで----- */

/* -----解説等-----







----解説ここまで---- */



LL N, A;



LL ans = 0LL;



int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	cin >> N >> A;

	VI a(N);

	FOR(i, 0, N) {

		cin >> a[i];

	}

	vector<VVL> dp(N + 1, VVL(N + 1, VL(2501, 0)));

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

	FOR(i, 0, N) {

		FOR(k, 0, N) {

			FOR(val, 0, 2501) {

				if(val+a[i]<=2500)dp[i + 1][k + 1][val + a[i]] += dp[i][k][val];

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

			}

		}

	}

	FOR(i, 1, N+1) {

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

	}



	cout << ans << "\n";



	return 0;

}


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

#include<cstring>

#include<cmath>

#include<algorithm>

#include<vector>

#define SF scanf

#define PF printf

#define MAXN 3010

using namespace std;

int n,v,x;

typedef long long ll;

ll dp[MAXN][MAXN];

int main(){

	SF("%d%d",&n,&x);

	dp[0][0]=1;

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

		SF("%d",&v);	

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

			for(int k=3000;k>=v;k--){

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

			}

	}

	ll ans=0;

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

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

	PF("%lld",ans);

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

using namespace std;

typedef double db;

typedef long long ll;

typedef vector<int> vi;

typedef pair<int, int> pii;

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pw(x) (1ll << (x))

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

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

#define rep(i,l,r) for(int i=(l);i<(r);++i)

#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)

#define dd(x) cout << #x << " = " << x << ", "

#define de(x) cout << #x << " = " << x << endl



//-----

const int N = 50 + 6, B = 2500;

int n, a, x[N];

ll dp[N][N * 100];

int main() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

  cin >> n >> a;

  rep(i, 1, n + 1) cin >> x[i], x[i] -= a;

  dp[0][B + 0] = 1;

  rep(i, 0, n + 1) rep(j, 0, 2 * B) if (dp[i][j]) {

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

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

	}

	cout << dp[n][B] - 1;

	return 0;

}

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

#include<cstring>

#include<cmath>

#include<algorithm>

#include<vector>

#define SF scanf

#define PF printf

#define MAXN 3010

using namespace std;

int n,v,x;

typedef long long ll;

ll dp[MAXN][MAXN];

int main(){

	SF("%d%d",&n,&x);

	dp[0][0]=1;

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

		SF("%d",&v);	

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

			for(int k=3000;k>=v;k--){

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

			}

	}

	ll ans=0;

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

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

	PF("%lld",ans);

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

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

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

#define PB push_back

#define EB emplace_back

#define MP make_pair

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

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

#define debug(x) cerr << #x << ": " << x << endl

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

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



/* -----  2018/02/14  Problem: 060_arc_a / Link: https://arc060.contest.atcoder.jp/tasks/arc060_a?lang=en  ----- */

/* ------問題------







-----問題ここまで----- */

/* -----解説等-----







----解説ここまで---- */



LL N, A;



LL ans = 0LL;



int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	cin >> N >> A;

	VI a(N);

	FOR(i, 0, N) {

		cin >> a[i];

	}

	vector<VVL> dp(N + 1, VVL(N + 1, VL(2501, 0)));

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

	FOR(i, 0, N) {

		FOR(k, 0, N) {

			FOR(val, 0, 2501) {

				if(val+a[i]<=2500)dp[i + 1][k + 1][val + a[i]] += dp[i][k][val];

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

			}

		}

	}

	FOR(i, 1, N+1) {

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

	}



	cout << ans << "\n";



	return 0;

}


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

using namespace std;

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

int x[55];

int main()

{

	int n,a;

	cin>>n>>a;

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

		cin>>x[i];

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

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

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

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

			{

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

				if(j==1)

					dp[i][j][k]+=(x[i]==k);

			}

	long long sum=0;

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

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

	cout<<sum<<endl;

	return 0;

}

//