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

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

}

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

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

  return 0;

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

}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

  return 0;

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

}

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

#include <string.h>

#include <algorithm>

using namespace std;

long long dp[60][2501],a[60];

int main()

{

	long long  n,i,j,k,s,t,k1;

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

	{

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

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

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

	  dp[0][0]=1;

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

	    {

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

	    	  {

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

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

			  }

		}

	  long long m=0;

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

	    {

	    	int x=i*k1;

	    	if(x<=2500) m+=dp[i][x];

		}

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

	}

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

}