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



using namespace std;



const int maxN = 50;

const int maxA = 50;



int N, A;

int x[maxN];

long long f[maxN + 1][maxA * maxN + 1];



int main() {

	ios::sync_with_stdio(false);

	cin.tie(nullptr);

	cout.tie(nullptr);



	cin >> N >> A;

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

		cin >> x[i];



	f[0][0] = 1;

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

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

			for (int k = A * N; k >= x[i]; k--)

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

		}

	}



	long long ans = 0;

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

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



	cout << ans << '\n';



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

using namespace std;

long long dp[51][2510];

int a[111];

int n, A;

int main(){

	ios::sync_with_stdio(0);

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

	cin >> n >> A;

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

	dp[0][0] = 1;

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

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

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

				if(j >= a[i])

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

	}

	long long ans = 0;

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

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

	cout << ans << "\n";

	return 0;

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

}


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

using namespace std;

long long dp[51][2510];

int a[111];

int n, A;

int main(){

	ios::sync_with_stdio(0);

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

	cin >> n >> A;

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

	dp[0][0] = 1;

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

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

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

				if(j >= a[i])

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

	}

	long long ans = 0;

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

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

	cout << ans << "\n";

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

using namespace std;



int main() {

	int n, A; cin >> n >> A;

	vector<int> a(n);

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

		cin >> a[i];

		a[i] -= A;

	}

	int now = 0;

	const int M = 25*102;

	long long dp[2][M*2] = {0};

	dp[0][M] = 1;

	int lsum = 0, rsum = 0;

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

		now ^= 1;

		memcpy(dp[now], dp[!now], sizeof dp[now]);

		for (int j = lsum; j <= rsum; j++) {

			if (dp[!now][j + M]) {

				dp[now][j + a[i] + M] += dp[!now][j + M];

			}

		}

		if (a[i] >= 0) {

			rsum += a[i];

		} else {

			lsum += a[i];

		}

	}

	cout << dp[now][M] - 1 << endl;

	return 0;

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

}


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

using namespace std;



int main() {

	int n, A; cin >> n >> A;

	vector<int> a(n);

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

		cin >> a[i];

		a[i] -= A;

	}

	int now = 0;

	const int M = 25*102;

	long long dp[2][M*2] = {0};

	dp[0][M] = 1;

	int lsum = 0, rsum = 0;

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

		now ^= 1;

		memcpy(dp[now], dp[!now], sizeof dp[now]);

		for (int j = lsum; j <= rsum; j++) {

			if (dp[!now][j + M]) {

				dp[now][j + a[i] + M] += dp[!now][j + M];

			}

		}

		if (a[i] >= 0) {

			rsum += a[i];

		} else {

			lsum += a[i];

		}

	}

	cout << dp[now][M] - 1 << 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: 2.457794528900323x):
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

LL dp[55][55][2505];

int main(){

    int n, a, x;

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

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

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

        scanf("%d", &x);

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

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

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

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

            }

        }

    }   

    LL ans = 0;

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

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

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

}


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

using namespace std;

typedef long long LL;

LL dp[55][55][2505];

int main(){

    int n, a, x;

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

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

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

        scanf("%d", &x);

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

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

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

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

            }

        }

    }   

    LL ans = 0;

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

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

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

using namespace std;

typedef long long LL;

LL dp[55][55][2505];

int main(){

    int n, a, x;

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

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

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

        scanf("%d", &x);

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

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

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

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

            }

        }

    }   

    LL ans = 0;

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

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

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

using namespace std;



int main() {

	int n, A; cin >> n >> A;

	vector<int> a(n);

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

		cin >> a[i];

		a[i] -= A;

	}

	int now = 0;

	const int M = 25*102;

	long long dp[2][M*2] = {0};

	dp[0][M] = 1;

	int lsum = 0, rsum = 0;

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

		now ^= 1;

		memcpy(dp[now], dp[!now], sizeof dp[now]);

		for (int j = lsum; j <= rsum; j++) {

			if (dp[!now][j + M]) {

				dp[now][j + a[i] + M] += dp[!now][j + M];

			}

		}

		if (a[i] >= 0) {

			rsum += a[i];

		} else {

			lsum += a[i];

		}

	}

	cout << dp[now][M] - 1 << endl;

	return 0;

}

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

using namespace std;

typedef long long LL;

LL dp[55][55][2505];

int main(){

    int n, a, x;

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

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

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

        scanf("%d", &x);

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

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

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

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

            }

        }

    }   

    LL ans = 0;

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

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

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

const int MAXN = 51;

const int ZERO = 2551;

const int MAXM = ZERO*2;

typedef long long LL;

LL F[MAXN][MAXM];

int C[MAXN];

int main()

{

	int N, A, i, j, x;

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

	F[0][ZERO] = 1;

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

	{

		scanf("%d", &x);

		x -= A;

		for(j=MAXN; j+MAXN<MAXM; ++j)

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

	}

	printf("%lld\n", F[N][ZERO]-1);

}

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

const int MAXN = 51;

const int ZERO = 2551;

const int MAXM = ZERO*2;

typedef long long LL;

LL F[2][MAXM];

int main()

{

	int N, A, i, j, x;

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

	F[0][ZERO] = 1;

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

	{

		scanf("%d", &x);

		x -= A;

		for(j=MAXN; j+MAXN<MAXM; ++j)

			F[i&1][j] = F[(i-1)&1][j] + F[(i-1)&1][j-x];

	}

	printf("%lld\n", F[N&1][ZERO]-1);

}
// Slower C++ solution:


#include "bits/stdc++.h"

#include <unordered_set>

using namespace std;



#define DEBUG(x) cout<<#x<<": "<<x<<endl;

#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl



typedef long long ll;

#define vi vector<int>

#define vl vector<ll>

#define vii vector< vector<int> >

#define vll vector< vector<ll> >

#define vs vector<string>

#define pii pair<int,int>

#define pis pair<int,string>

#define psi pair<string,int>

const int inf = 1000000001;

const ll INF = 1e16;

#define MOD 1000000007

#define mod 1000000009

#define pi 3.14159265358979323846

#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;

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

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



int main() {

	int n, a, i, j, k;

	cin >> n >> a;

	vi x(n);

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

		cin >> x[i];

	}

	vector< vll > dp(n + 1, vll(n + 1, vl(2501, 0)));

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

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

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

			for (k = 0; k <= 2500; k++) {

				if (dp[i][j][k] != 0) {

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

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

				}

			}

		}

	}

	ll sum = 0;

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

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

	}

	cout << sum << endl;

}

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

#include <unordered_set>

using namespace std;



#define DEBUG(x) cout<<#x<<": "<<x<<endl;

#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl



typedef long long ll;

#define vi vector<int>

#define vl vector<ll>

#define vii vector< vector<int> >

#define vll vector< vector<ll> >

#define vs vector<string>

#define pii pair<int,int>

#define pis pair<int,string>

#define psi pair<string,int>

const int inf = 1000000001;

const ll INF = 1e16;

#define MOD 1000000007

#define mod 1000000009

#define pi 3.14159265358979323846

#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;

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

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



/*

int main() {

	int n, a, i, j, k;

	cin >> n >> a;

	vi x(n);

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

		cin >> x[i];

	}

	vector< vll > dp(n + 1, vll(n + 1, vl(2501, 0)));

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

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

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

			for (k = 0; k <= 2500; k++) {

				if (dp[i][j][k] != 0) {

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

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

				}

			}

		}

	}

	ll sum = 0;

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

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

	}

	cout << sum << endl;

}

*/



int main() {

	int n, a, i, j, k;

	cin >> n >> a;

	vi x(n);

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

		cin >> x[i];

		x[i] -= a;

	}

	vll dp(n + 1,vl(5010));

	dp[0][2500] = 1;

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

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

			if (dp[i][j] != 0) {

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

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

			}

		}

	}

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

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

using namespace std;



typedef long long ll;



ll dp[51][2501];



int main(){

	int n, A;

	cin >> n >> A;

	vector <int> a(n);

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

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

	}

	dp[0][0] = 1;

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

		int x = a[i];

		for (int k = 50; k >= 0; k--){

			for (int y = 0; y <= 2500; y++) {

				if (!dp[k][y]) continue;

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

			}

		}

	}

	ll ans = 0;

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

		for (int y = 0; y <= 2500; y++){

			if (k * A == y) ans += dp[k][y];

		}

	}

	cout << ans << endl;

}


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

using namespace std;



int n, A;

int a[51];

long long ways[51][11000];



int main() {

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

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

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

		a[i] -= A;

	}

	ways[0][5000] = 1;

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

		for (int w = -2500; w <= 2500; w++) {

			ways[i + 1][w + 5000] += ways[i][w + 5000];

			ways[i + 1][w + 5000] += ways[i][w + 5000 - a[i]];

		}

	}

	printf("%lld\n", ways[n][5000] - 1);

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

using namespace std;



typedef long long ll;



ll dp[51][2501];



int main(){

	int n, A;

	cin >> n >> A;

	vector <int> a(n);

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

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

	}

	dp[0][0] = 1;

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

		int x = a[i];

		for (int k = 50; k >= 0; k--){

			for (int y = 0; y <= 2500; y++) {

				if (!dp[k][y]) continue;

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

			}

		}

	}

	ll ans = 0;

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

		for (int y = 0; y <= 2500; y++){

			if (k * A == y) ans += dp[k][y];

		}

	}

	cout << ans << endl;

}


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

using namespace std;



int x[60];

long long f[60][2510];



int main(){

	int n, A;

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

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

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

	}

	f[0][0] = 1;

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

		for (int j = n; j >= 1; j--){

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

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

			}

		}

	}

	long long ans = 0;

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

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

	}

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

	return 0;

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

using namespace std;



typedef long long ll;



ll dp[51][2501];



int main(){

	int n, A;

	cin >> n >> A;

	vector <int> a(n);

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

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

	}

	dp[0][0] = 1;

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

		int x = a[i];

		for (int k = 50; k >= 0; k--){

			for (int y = 0; y <= 2500; y++) {

				if (!dp[k][y]) continue;

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

			}

		}

	}

	ll ans = 0;

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

		for (int y = 0; y <= 2500; y++){

			if (k * A == y) ans += dp[k][y];

		}

	}

	cout << ans << endl;

}


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

using namespace std;



int x[60];

int sum[60];

long long f[60][2510];



int main(){

	int n, A;

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

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

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

		sum[i] = x[i];

		if (i) sum[i] += sum[i - 1];

	}

	f[0][0] = 1;

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

		for (int j = n; j >= 1; j--){

			for (int k = sum[i]; k >= x[i]; k--){

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

			}

		}

	}

	long long ans = 0;

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

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

	}

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

	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;



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

}