#include<bits/stdc++.h>
using namespace std;
long long d[105][100004],n,i;
int a[105],k;
ll mod = 1000000007;
long long dp(int i,int x,int y){
    if(i==n) return (x+y==0);
    if(x<0) return 0;
    if(d[i][x+y]!=-1) return d[i][x];
    long long one,two;
    one=dp(i,x-1,y)%mod;
    two=dp(i+1,min(x+y,a[i+1]),x+y-min(x+y,a[i+1]))%mod;
    d[i][x+y]=(one%mod+two%mod)%mod;
    return d[i][x+y]%mod;
}
int main(){
    memset(d,-1,sizeof d);
    cin>>n>>k;
    for(i=0;i<n;i++) cin>>a[i];
    cout<<(dp(0,min(a[0],k),k-min(a[0],k)))%mod;
    return 0;
}
