#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

int n,k;
int a[100005];
ll dp[105][100005];
ll sum[100005];
int main() {
    scanf("%d%d",&n,&k);
    for(int i = 1;i<=n;i++) scanf("%d",&a[i]);
    for(int i = 0;i<=n;i++) dp[i][0] = 1;
    for(int i = 1;i<=n;i++) {
        sum[0] = 0;
        for(int j = 1;j<=k+1;j++) sum[j] = sum[j-1] + dp[i-1][j-1];
        for(int j = 1;j<=k;j++) 
            dp[i][j] = (sum[j+1] - sum[max(0,j-a[i])] + mod) % mod;
    }
    printf("%lld\n",dp[n][k]);
    return 0;
}