#include #define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++) #define MOD 1000000007 using namespace std; typedef long long ll; ll N, K, A[300]; int main(void) { cin >> N >> K; REP(i, 0, N) cin >> A[i]; vector< vector > dp(N + 1, vector(K + 1, 0)); dp[0][0] = 1; REP(i, 0, N) { vector sum(K + 2, 0LL); REP(j, 0, K + 1) sum[j + 1] = dp[i][j]; REP(j, 0, K + 1) { sum[j + 1] += sum[j]; sum[j + 1] %= MOD; } REP(j, 0, K + 1) { ll l = max(j - i, 0LL), r = j; dp[i + 1][j] += sum[r + 1] - sum[l]; dp[i + 1][j] %= MOD; } } ll ans = 0; REP(i, 0, K + 1) { ans += dp[N][i]; ans %= MOD; } cout << ans << endl; }