#include <cstdio>

const int MOD=1e9+7;

int N,K;

int dp[100005];

int main(){
  scanf("%d %d",&N,&K);
  dp[0]=1;
  for(int t=0;t<N;t++){
    int A;
    scanf("%d",&A);
    for(int i=1;i<=K;i++){
      dp[i]=(dp[i]+dp[i-1])%MOD;
    }
    for(int i=K;i>A;i--){
      dp[i]=(dp[i]-dp[i-A-1])%MOD;
    }
  }
  printf("%d\n",(dp[K]+MOD)%MOD);
  return 0;
}
