stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}




// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

//

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

 

using namespace std;

typedef long long ll;

ll ta[55][55][2555];

ll a[55];

 

signed main(){

	//freopen(".INP","r",stdin);

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

	ios_base::sync_with_stdio(0);

	cin.tie(0);

	cout.tie(0);

	ll n, m;

	cin >> n >> m;

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

		cin >> a[i];

	}

	ta[0][0][0] = 1;

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

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

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

				if (ta[i][j][k]){

					ta[i + 1][j + 1][k + a[i]] += ta[i][j][k];

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

				}

			}

		}

	}

	ll ans = 0;

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

		ans += ta[n][i][i * m];

	}

	cout << ans;

	return 0;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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);

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

typedef long long ll;

const int N=2550;

ll f[6007][57]={0};

int n,a,num[57];

int main()

{

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

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

	{

		int x;

		scanf("%d",&x);

		num[i]=x-a;

	}

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

	{

		for (int j = 55; j < 5057; ++j)

		{

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

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

		}

		f[N+num[i]][i]++;

	}

	printf("%lld\n", f[N][n]);

	return 0;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem: