#include <bits/stdc++.h>
const int MAXK = 1e5 + 5;
const int MAXN = 105;
const int MOD = 1e9 + 7;
int A[MAXN];
int dp[MAXN][MAXK];
int K, N;
int solve() {
  for (int j = 0; j <= K; ++j) {
    dp[0][j] = 1;
  }
  for (int i = 1; i <= N; ++i) {
    dp[i][0] = 1;
    for (int j = 1; j <= K; ++j) {
      int left = j - A[i] - 1;
      int tail = ((left < 0) ? 0 : dp[i - 1][left]);
      int prev = (1LL * dp[i - 1][j] - tail + MOD) % MOD;
      dp[i][j] = (1LL * dp[i][j - 1] + prev) % MOD;
    }
  }
  return dp[N][K] - dp[N][K - 1];
}
int main() {
  scanf(" %d%d", &N, &K);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &A[i]);
  }
  printf("%d\n", solve());
  return 0;
}
