#include <bits/stdc++.h>
#define BASE 3000
#define RANGE 2500

using namespace std;
typedef long long ll;

int main() {
    int n, a, x;
    ll f[BASE*2+1], tmp[BASE*2+1];
    cin >> n >> a;
    f[BASE] = 1;
    for(int i=0; i<n; i++) {
        cin >> x;
        x -= a;
        fill(tmp, tmp+(BASE*2+1), 0);
        for(int t=BASE-RANGE; t<=BASE+RANGE; t++) {
            tmp[t+x] = f[t];
        }
        for(int t=0; t<=BASE*2; t++) {
            f[t] += tmp[t];
        }
    }
    cout << f[BASE]-1 << endl;
    
}