MOD = 10 ** 9 + 7 from collections import defaultdict n, k = map(int, input().split()) a = list(map(int, input().split())) dp = defaultdict(int) dp[0] = 1 for i in range(n): ndp = defaultdict(int) for x, v in dp.items(): ndp[x] = (ndp[x] + v) % MOD ndp[x + a[i] - k] = (ndp[x + a[i] - k] + v) % MOD dp = ndp ans = 0 for x, v in dp.items(): if x >= 0: ans = (ans + v) % MOD ans -= 1 print(ans)