#include <iostream>
#include <stdio.h>

#define maxn 51
#define maxsum 5000
using namespace std;
int N, A;
// dp[i][j][k] = j carti din primele i carti care dau suma k
// dp[1][0][0] = 1
// dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - v[i]]
long long dp[maxn][maxn][maxsum];
int v[maxn];
int main()
{
    int mini = 100;
    long long rez = 0;
    scanf("%d %d", &N, &A);
    for (int i = 1; i <= N; ++i) {
        scanf("%d", &v[i]);
        mini = min(v[i], mini);
        // dp[i][1][v[i]] = 1;
        dp[i][0][0] = 1;
    }
    dp[0][0][0] = 1;
    for (int i = 1; i <= N; ++i) {
        for (int j = 1; j <= i; ++j) {
            for (int k = 0; k <= maxsum; ++k) {
                dp[i][j][k] = dp[i - 1][j][k];
                if (k - v[i] >= 0) {
                    dp[i][j][k] += dp[i - 1][j - 1][k - v[i]];
                }
        }
    }
    for (long long i = 1; i <= N; ++i) {
        rez += dp[N][i][i * A];
    }
    printf("%lld", rez);
    return 0;
}
