#include <bits/stdc++.h>
const int INF = 1e9, MOD = 1e9 + 7;
const long long LINF = 1e18;
using namespace std;
long long dp[123][223456];
signed main() {
  long long N, K;
  cin >> N >> K;
  std::vector<long long> v(N);
  for (long long i = 0; i < N; i++) cin >> v[i];
  memset(dp, 0, sizeof(dp));
  for (long long j = K + 1; j <= 200000; j++) dp[0][j] = 1;
  for (long long i = 1; i <= N; i++) {
    for (long long j = 0; j <= 200000; j++) {
      if (j <= 10005) {
        dp[i][j + 1] += dp[i - 1][j + v[i - 1] + 1] - dp[i - 1][j];
        dp[i][j + 1] %= MOD;
        dp[i][j + 1] += MOD;
        dp[i][j + 1] %= MOD;
      }
      dp[i][j + 2] += dp[i][j + 1];
    }
  }
  cout << dp[N][1] << endl;
}
