#include using namespace std; #define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++) #define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--) #define REP(i, n) FOR(i, 0, n) #define IREP(i, n) IFOR(i, 0, n) constexpr int MOD = 1000000007; int main() { cin.tie(nullptr), ios::sync_with_stdio(false); int N, K; cin >> N >> K; const int B = N * 100; vector dp(B * 2 + 1); dp[B] = 1; while (N--) { int a; cin >> a; a -= K; if (a >= 0) { IREP(i, int(dp.size()) - a) { dp[i + a] += dp[i]; if (dp[i + a] >= MOD) dp[i + a] -= MOD; } } else { FOR(i, -a, dp.size()) { dp[i + a] += dp[i]; if (dp[i + a] >= MOD) dp[i + a] -= MOD; } } } cout << (accumulate(dp.begin() + B, dp.end(), 0LL) - 1) % MOD << '\n'; }