#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <iomanip>

#include <map>
#include <set>
#include <queue>
#include <stack>

#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdbl vector<double>
#define vstr vector<string>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N,A;
	cin >> N >> A;

	int x[N];
	int y[N];
	rep(i,N){
		int t;
		cin >> t;
		x[i] = t;
		y[i] = t - A;
	}

	int X = A;
	rep(i,N) X = max(X,x[i]);

	int dp[N+1][2*N*X+1] = {};
	dp[0][N*X] = 1;

	FOR(j,1,N+1){
		int ny = y[j-1];
		rep(t,2*N*X+1){
			if(t - ny < 0 || t - ny > 2*N*X) {
				dp[j][t] = dp[j-1][t];
			}else if(0 <= t - ny && t - ny <= 2*N*X){
				dp[j][t] = dp[j-1][t] + dp[j-1][t-ny];
 			} 
		}
	}

	cout << dp[N][N*X] - 1<< endl;
}