mod = 10 ** 9 + 7 U = 10000 N, K = map(int, input().split()) A = list(map(int, input().split())) pos = [] neg = [] for a in A: a -= K if a >= 0: pos.append(a) else: neg.append(-a) def calc_DP(X): dp = [0] * (U + 1) dp[0] = 1 for p in X: for i in reversed(range(p, U + 1)): dp[i] += dp[i - p] dp[i] %= mod dp[0] -= 1 return dp pos = calc_DP(pos) neg = calc_DP(neg) for i in range(1, U + 1): neg[i] += neg[i - 1] neg[i] %= mod ans = sum(pos) % mod for i, v in enumerate(pos): ans += v * neg[i] ans %= mod print(ans)