stablegradients/pie-gem5-pairs huggingface dataset:
// 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: 1.5128171769182968x):
#include<bits/stdc++.h>

using namespace std;

#define inf 0x3f3f3f3f

#define ll long long

const int N=55;

const int mod=1e9+7;

const double eps=1e-8;

const double PI = acos(-1.0);

#define lowbit(x) (x&(-x))

ll dp[N][N*N];

int main()

{

    std::ios::sync_with_stdio(false);

    int n,a;

    ll x;

    cin>>n>>a;

    dp[0][0]=1;

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

    {

        cin>>x;

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

        {

            for(int w=0;w<N*N;w++)

            {

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

            }

        }

    }

    ll ans=0;

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

    {

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

    }

    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: 3.3837490504408656x):
#include<bits/stdc++.h>

using namespace std;

#define inf 0x3f3f3f3f

#define ll long long

const int N=55;

const int mod=1e9+7;

const double eps=1e-8;

const double PI = acos(-1.0);

#define lowbit(x) (x&(-x))

ll dp[N][N*N];

int main()

{

    std::ios::sync_with_stdio(false);

    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 w=0;w<=N*j;w++)

        {

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

         //   cout<<j+1<<" "<<w+x<<" "<<dp[j+1][w+x]<<endl;

        }

    }

    ll ans=0;

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

    {

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

    }

    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.6784386779933678x):
#include<bits/stdc++.h>

using namespace std;

#define inf 0x3f3f3f3f

#define ll long long

const int N=55;

const int mod=1e9+7;

const double eps=1e-8;

const double PI = acos(-1.0);

#define lowbit(x) (x&(-x))

ll dp[N][N*N];

int main()

{

    std::ios::sync_with_stdio(false);

    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 w=0;w<=N*j;w++)

        {

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

         //   cout<<j+1<<" "<<w+x<<" "<<dp[j+1][w+x]<<endl;

        }

    }

    ll ans=0;

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

    {

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

    }

    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.455262308591425x):
#include<bits/stdc++.h>

using namespace std;

#define inf 0x3f3f3f3f

#define ll long long

const int N=55;

const int mod=1e9+7;

const double eps=1e-8;

const double PI = acos(-1.0);

#define lowbit(x) (x&(-x))

ll dp[N][N*N];

int main()

{

    std::ios::sync_with_stdio(false);

    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 w=0;w<=N*j;w++)

        {

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

         //   cout<<j+1<<" "<<w+x<<" "<<dp[j+1][w+x]<<endl;

        }

    }

    ll ans=0;

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

    {

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

    }

    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.2889045138771253x):
#include<bits/stdc++.h>

using namespace std;

#define inf 0x3f3f3f3f

#define ll long long

const int N=55;

const int mod=1e9+7;

const double eps=1e-8;

const double PI = acos(-1.0);

#define lowbit(x) (x&(-x))

ll dp[N][N*N];

int main()

{

    std::ios::sync_with_stdio(false);

    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 w=0;w<=N*j;w++)

        {

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

         //   cout<<j+1<<" "<<w+x<<" "<<dp[j+1][w+x]<<endl;

        }

    }

    ll ans=0;

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

    {

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

    }

    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: 2.588880373907205x):
#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;

}
// 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: 1.7149783271128196x):
#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;

}
// 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: 0.9943865423511462x):
#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;

}
// 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.484982415366724x):
#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;

#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.7286533932875887x):
#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;



#define int long long



const int N = 50 + 5, M = N * N;

int n, A, ar[N], dp[2][N][M];



int32_t main() {

	ios::sync_with_stdio(0);

	cin.tie(0);

	

	cin >> n >> A;

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

		cin >> ar[i];

	

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

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

		int now = (i & 1), prv = (now ^ 1);

		dp[now][0][0] = dp[prv][0][0];

		

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

			for (int x = 0; x < M; x++) {			

				dp[now][j][x] = dp[prv][j][x];

				if (ar[i] <= x)

					dp[now][j][x] += dp[prv][j - 1][x - ar[i]];

			}	

	}

	

	int ans = 0;

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

		int x = A * j;

		ans += dp[n & 1][j][x];

	}

	cout << ans << endl;

}

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

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.792023669312125x):
#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>

#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.511988763294717x):
#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;

}