import numpy as np N, K = map(int, input().split()) A = [int(x) - K for x in input().split()] MOD = 10 ** 9 + 7 L = 10000 dp = np.zeros(2 * L + 1, dtype=int) dp[L] = 1 for a in A: if a >= 0: dp[a:] += dp[:-a] else: dp[:a] += dp[-a:] dp %= MOD print(dp[L:].sum() - 1)