#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 101, MAX_K = 1e5 + 1, mod = 1e9 + 7;
int n, K, A[MAX_N], dp[MAX_N][MAX_K];
int main() {
  scanf("%d %d", &n, &K);
  for (int i = 0; i < (int)(n); i++) scanf("%d", &A[i]);
  for (int i = 0; i < (int)(n + 1); i++) dp[i][0] = 1;
  for (int i = 1; i <= (int)(n); i++) {
    for (int j = 1; j <= (int)(K); j++) {
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
      if (j - 1 - A[i - 1] >= 0)
        dp[i][j] = (dp[i][j] - dp[i - 1][j - 1 - A[i - 1]] + mod) % mod;
    }
  }
  printf("%d\n", dp[n][K]);
  return 0;
}
