#include <cstdio>
#include <algorithm>

int n, k;
int A[100];

constexpr int mod = 1000000007;
int dp[101][100001];

int main(){
  scanf("%d%d", &n, &k);
  for(int i = 0; i < n; i++) scanf("%d", A+i);
  dp[0][0] = 1;
  for(int i = 1; i <= n; i++){
    int sum[100001];
    for(int j = 0; j <= k; j++){
      sum[j] = (j ? sum[j-1] : 0) + dp[i-1][j];
      if(sum[j] >= mod) sum[j] -= mod;
      dp[i][j] = sum[j] + (A[i-1] >= j ? 0 : mod - sum[j-A[i-1]-1]);
      if(dp[i][j] >= mod) dp[i][j] -= mod;
    }
  }
  printf("%d\n", dp[n][k]);
  return 0;
}
