#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int N, K, a[102], mod=1e9+7; ll dp[101][100001]; 
int main(){
    scanf("%d %d", &N, &K);
    for(int i=1; i<=N; i++) scanf("%d", &a[i]);
    dp[0][0] = 1;
    for(int i=1; i<=N; i++){
        dp[i][0] = 1;
        for(int j=1; j<=K; j++){
            dp[i][j] = (dp[i-1][j] - (j>=a[i]+1? dp[i-1][j-a[i]-1]: 0) + mod) % mod;
            dp[i][j] = (dp[i][j] + dp[i][j-1]) % mod;
        }
    }
    printf("%lld\n", dp[N][K]);
}