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

#define maxN 100005

#define oo 1000000007

#define maxM 2500

#define mp make_pair

#define pb push_back

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

#define bugarr(a, x, y) cout << #a << "[" << x << ", " << y << "]= "; for (int i = x; i <= y; ++i) cout << a[i] << ", "; cout << endl;

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

#define vii vector<pi>

#define db double

#define forit(var, it) for(__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)



using namespace std;



int n, A, a[100];

ll f[100][10005];



int main() {

   // #ifndef ONLINE_JUDGE

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

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

    //#endif // ONLINE_JUDGE



    scii(n, A);

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

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

    //fto(i, 1, n) cout << a[i] << "\n";

    fto(i, 0, 7000) f[0][i] = 0;

    f[0][2500] = 1;

    fto(i, 1, n) {

        fto(j, -2500, 2500) {

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

            if (j - a[i] + maxM >= 0) f[i][j+maxM]+=f[i-1][j-a[i]+maxM];

            //cout << i << " " << j << " " << j-a[i] << " " << f[i][j+maxM] << "\n";

        }

    }

    //cout << f[1][maxM] << "\n";

    cout << f[n][maxM] - 1;



    return 0;

}


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

#include<cstring>

using namespace std;

#define ll long long

ll dp[2500][50];

ll a[50];

; int main()

{

	int n, ave;

	cin >> n >> ave;

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

		cin >> a[i];

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

	dp[0][0] = 1;

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

		for (int j = n * 50; j >= a[i]; j--)

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

				if (dp[j - a[i]][k - 1])

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

	ll ans = 0;

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

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

	cout << ans << endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.5261693077174234x):
#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 <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.423746911549847x):
#include <iostream>

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>

#include <iomanip>

using namespace std;

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

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

typedef long long ll;

ll dp[55][55 * 55];

int k;

int n;

int main()

{

    cin >> n >> k;

    int x;

    dp[0][0] = 1ll;

    repd(i, 1, n)

    {

        cin >> x;

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

        {

            for (int w = 0; w <= 55 * j; w++)

            {

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

            }

        }

    }

    ll ans = 0ll;

    repd(i, 1, n)

    {

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

    }

    cout << ans << endl;

    return 0;

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

using namespace std;

#define ll long long

#define int ll

#define mn 100005

#define inf 4444444444444444444

#define mod (ll) 1000000007

#define base 31

#define fi first

#define se second

#define pii pair <int, int>

#define pb push_back

#define mp make_pair



//int t, ntest;

int n, k, ans;

int a[55], dp[55][55][2505];



void input(){

	cin>>n>>k;

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

		cin>>a[i];

	}

}



// i so dau tien, chon j so, tong la t

int d (int i, int j, int t){

	if (j>i) return 0;

	if (j<0 || i<0 || t<0) return 0;

	if (t==0){

		if (j==0) return 1;

		return 0;

	}

	if (j==0 && t!=0) return 0;

	if (dp[i][j][t]<inf) return dp[i][j][t];

	return dp[i][j][t]=d(i-1, j, t)+d(i-1, j-1, t-a[i]);

}



void output(){



}



void solve(){

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

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

			for (int t=1; t<=2500; t++){

				dp[i][j][t]=inf;

			}

		}

	}

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

		ans+=d(n, i, k*i);

	}

	cout<<ans;

}



signed main(){

	ios_base::sync_with_stdio(0);

	cin.tie(0);

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

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

//	cin>>t;

//	for (ntest=1; ntest<=t; ntest++){

		input();

		solve();

		output();

//	}

}



//mtrang_149


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

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>

#include <iomanip>

using namespace std;

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

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

typedef long long ll;

ll dp[55][55 * 55];

int k;

int n;

int main()

{

    cin >> n >> k;

    int x;

    dp[0][0] = 1ll;

    repd(i, 1, n)

    {

        cin >> x;

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

        {

            for (int w = 0; w <= 55 * j; w++)

            {

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

            }

        }

    }

    ll ans = 0ll;

    repd(i, 1, n)

    {

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

    }

    cout << ans << endl;

    return 0;

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

using namespace std;



const int MAXN = 55;

long long dp[MAXN][MAXN * MAXN];

int n, A, a[MAXN];



int main() {

	cin >> n >> A;

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

		cin >> a[i];

	dp[0][0] = 1;

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

		for (int j = MAXN * MAXN - 1; j >= 0; j--)

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

				if (j - a[t] >= 0)

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

	long long ans = 0;

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

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

	cout << ans;

}

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

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>

#include <iomanip>

using namespace std;

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

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

typedef long long ll;

ll dp[55][55 * 55];

int k;

int n;

int main()

{

    cin >> n >> k;

    int x;

    dp[0][0] = 1ll;

    repd(i, 1, n)

    {

        cin >> x;

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

        {

            for (int w = 0; w <= 55 * j; w++)

            {

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

            }

        }

    }

    ll ans = 0ll;

    repd(i, 1, n)

    {

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

    }

    cout << ans << endl;

    return 0;

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

#include<iostream>

using namespace std;

#define mn 100005

#define FLN "code"

#define endl "\n"

#define int long long

#define fi first

#define se second

#define inf 4444444444444444444

#define mod 1000000009

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

#define FOR0(i, a) for (int i=0; i<(a); i++)

#define FOR1(i, a) for (int i=1; i<=(a); i++)

#define codenhanh(); ios_base::sync_with_stdio(0) ,cin.tie(0),cout.tie(0);



int n,m,a[mn];

int dem=0;

vector<int> sum;

signed main()

{

	#ifdef komandocode

	freopen("code.inp", "r", stdin);

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

	#endif

	codenhanh();

	cin>>n;

	cin>>m;

	int dp[60][3000];

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

	dp[0][0]=1;

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

		cin>>a[i];

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

			{

				for(int p=0;p<=55*j;p++){

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

				}	

			}

			}

            



	int ans=0;

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

	{

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

	}

	cout<<ans;

return 0;

}




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

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>

#include <iomanip>

using namespace std;

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

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

typedef long long ll;

ll dp[55][55 * 55];

int k;

int n;

int main()

{

    cin >> n >> k;

    int x;

    dp[0][0] = 1ll;

    repd(i, 1, n)

    {

        cin >> x;

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

        {

            for (int w = 0; w <= 55 * j; w++)

            {

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

            }

        }

    }

    ll ans = 0ll;

    repd(i, 1, n)

    {

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

    }

    cout << ans << endl;

    return 0;

}
// Slower C++ solution:
#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 pi pair<int, int>

#define maxN 100005

#define oo 1000000007

#define maxM 2500

#define mp make_pair

#define pb push_back

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

#define bugarr(a, x, y) cout << #a << "[" << x << ", " << y << "]= "; for (int i = x; i <= y; ++i) cout << a[i] << ", "; cout << endl;

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

#define vii vector<pi>

#define db double

#define forit(var, it) for(__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)



using namespace std;



int n, A, a[100];

ll f[100][10005];



int main() {

   // #ifndef ONLINE_JUDGE

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

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

    //#endif // ONLINE_JUDGE



    scii(n, A);

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

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

    //fto(i, 1, n) cout << a[i] << "\n";

    fto(i, 0, 7000) f[0][i] = 0;

    f[0][2500] = 1;

    fto(i, 1, n) {

        fto(j, -2500, 2500) {

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

            if (j - a[i] + maxM >= 0) f[i][j+maxM]+=f[i-1][j-a[i]+maxM];

            //cout << i << " " << j << " " << j-a[i] << " " << f[i][j+maxM] << "\n";

        }

    }

    //cout << f[1][maxM] << "\n";

    cout << f[n][maxM] - 1;



    return 0;

}


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

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>

#include <iomanip>

using namespace std;

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

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

typedef long long ll;

ll dp[55][55 * 55];

int k;

int n;

int main()

{

    cin >> n >> k;

    int x;

    dp[0][0] = 1ll;

    repd(i, 1, n)

    {

        cin >> x;

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

        {

            for (int w = 0; w <= 55 * j; w++)

            {

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

            }

        }

    }

    ll ans = 0ll;

    repd(i, 1, n)

    {

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

    }

    cout << ans << endl;

    return 0;

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

#include<cstring>

using namespace std;

#define ll long long

ll dp[2500][50];

ll a[50];

; int main()

{

	int n, ave;

	cin >> n >> ave;

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

		cin >> a[i];

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

	dp[0][0] = 1;

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

		for (int j = n * 50; j >= a[i]; j--)

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

				if (dp[j - a[i]][k - 1])

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

	ll ans = 0;

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

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

	cout << ans << endl;

	return 0;

}

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

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>

#include <iomanip>

using namespace std;

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

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

typedef long long ll;

ll dp[55][55 * 55];

int k;

int n;

int main()

{

    cin >> n >> k;

    int x;

    dp[0][0] = 1ll;

    repd(i, 1, n)

    {

        cin >> x;

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

        {

            for (int w = 0; w <= 55 * j; w++)

            {

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

            }

        }

    }

    ll ans = 0ll;

    repd(i, 1, n)

    {

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

    }

    cout << ans << endl;

    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.79219661188382x):
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

typedef long long ll;

ll dp[55][2600];

int v[55];

int main(void)

{

	int N, A;

	ll sum = 0;

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

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

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

	dp[0][0] = 1;

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

	{

		sum += v[k];

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

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

				dp[i][j] += dp[i - 1][j - v[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<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: 5.717945021687113x):
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

typedef long long ll;

ll dp[55][2600];

int v[55];

int main(void)

{

	int N, A;

	ll sum = 0;

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

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

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

	dp[0][0] = 1;

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

	{

		sum += v[k];

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

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

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

}

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

#include<stdlib.h>

#include<string.h>

typedef long long ll;

ll dp[55][2600];

int v[55];

int main(void)

{

	int N, A;

	ll sum = 0;

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

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

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

	dp[0][0] = 1;

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

	{

		sum += v[k];

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

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

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

}

//

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

#include<stdlib.h>

#include<string.h>

typedef long long ll;

ll dp[55][2600];

int v[55];

int main(void)

{

	int N, A;

	ll sum = 0;

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

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

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

	dp[0][0] = 1;

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

	{

		sum += v[k];

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

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

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

#include<cstring>

#define RG register

#define LL long long

using namespace std;

const int N=52;

int n,a,x[N];

LL ans,dp[N][N][N*N];

template<typename I> inline void read(I &ot){

	I ch=getchar(), x=0, f=1;

	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}

	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}

	ot=x*f;}

template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}

int main()

{

//	freopen("Tak and Cards.in","r",stdin);

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

	read(n,a);

	for(int i=1;i<=n;i++) read(x[i]);

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

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

	{

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

		{

			for(int k=a*n;k>=0;k--)

			{

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

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

			}

		}

	}

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

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

	//fclose(stdin); fclose(stdout);

	return 0;

}


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

#include<stdlib.h>

#include<string.h>

typedef long long ll;

ll dp[55][2600];

int v[55];

int main(void)

{

	int N, A;

	ll sum = 0;

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

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

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

	dp[0][0] = 1;

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

	{

		sum += v[k];

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

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

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

	}

	ll ans = 0;

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

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

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

	return 0;

}