import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(int a, int[] xs) {
    int n = cast(int)xs.length;
    int m = xs.sum;
    auto dp = new long[][](n + 1, m + 1);

    foreach (x; xs) {

        for (int i = n-1; i > 0; i--) {
            for (int j = 0; j < m; j++) {
                if (dp[i][j] > 0) {
                    dp[i + 1][j + x] += dp[i][j];
                }
            }
        }

        dp[1][x]++;
    }

    long ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            if (dp[i][j] > 0 && (j % i == 0) && (j / i == a)) {
                ans += dp[i][j];
            }
        }
    }

    return ans;
}

void main() {
    auto na = readints;
    int a = na[1];
    auto xs = readints;

    writeln(calc(a, xs));
}
