#include <bits/stdc++.h>
#define DIM 107
#define modulo 1000000007
using namespace std;

long long n,k,a[DIM],p[DIM][100007];

int main()
{
    cin>>n>>k;
    for(int i = 1; i <= n; ++i)
        cin>>a[i];

    for(int i = 0; i <= k; ++i)
        p[0][i] = 1;

    for(int i = 1; i <= n; ++i)
        for(int j = 0; j <= k; ++j)
    {
        p[i][j] = p[i][j-1] + p[i-1][j];
        if(a[i]<j) p[i][j]-=p[i-1][j-a[i]-1];
        p[i][j]+=modulo;
        p[i][j]%=modulo;
    }

    cout<<(p[n][k]-p[n][k-1]+modulo)%modulo;
    return 0;
}
