#define MAXN 100100
 
int ft[MAXN +1]; // for more dimensions, make ft multi-dimensional
void upd(int i0, int v){ // add v to i0th element (0-based)
        // add extra fors for more dimensions
        for(int i=i0+1;i<=MAXN;i+=i&-i)ft[i]= (ft[i] + v)%mod;
}
int get(int i0){ // get sum of range [0,i0)
        int r=0;
        // add extra fors for more dimensions
        for(int i=i0;i;i-=i&-i)r= (r +ft[i])%mod;;
        return r;
}
int get_sum(int i0, int i1){ // get sum of range [i0,i1) (0-based)
        return (get(i1)-get(i0)+mod)%mod;
}
int a[101];
int dp[100001][2];
 
int32_t main(int32_t argc, char const *argv[]){
    FIN;
 
    int n ,k;cin>>n>>k;
    fore(i,0,n)cin>>a[i];
    bool b = true;
    fore(i,0,a[n-1]+1){
        dp[i][b] =1;
        upd(i,1);
    }
 
    rfore(i,0,n-1){
        b = !b;
        fore(j,0,k+1){
            dp[j][b] = get_sum(max(j-a[i],0ll),j+1);
         //   cout<<dp[j][b]<<" ";
        }
        mm(ft,0);
        fore(j,0,k+1){
            upd(j,dp[j][b]);
        }
    }
    cout<<dp[k][b];
 
 
    return 0;
}