#include<bits/stdc++.h>
#define fori(x,a,b) for (int x=a;x<=b;x++)
#define int long long
using namespace std;
const int K = 1e5+10;
const int mod = 1e9+7;
int n,k,a;
int f[K];
void add(int &a,int b)
{
    a = a+b;
    if (a>=mod) a-=mod;
}
 main()
{
    cin>>n>>k;
    f[0] =1 ;
    fori(i,1,n)
    {
        cin>>a;
        for (int used = k;used>=0;used--)
        {
            int tmp = f[used];
            int l = used + 1;
            int r = used + min(a,k-used);
            fori(j,l,r)
            add(f[j],tmp);
        }
    }
     cout<<f[k];
}
