#include <iostream>
#include <algorithm>
#include <vector>

#define mod 1e9+5

using namespace std;
using ll = long long; 

void add_self(int& a, int b){
    a +=b;
    a -= a>=mod ? mod : 0;
}

void sub_self(int& a, int b){a -=b;}

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int>dp(k+1);
    vector<int>fake(k+1);
    dp[0] =1;
    
    while(n--){
        int up_to;
        scanf("%d" ,&up_to);
        
        for(int used = k; used >=0; used--){
            int l = used + 1;
            int r = used + min(up_to ,k - used);
            int tmp = dp [used];
            
            if(l <= r){
                add_self(fake[l]; tmp)
                if(r+1<k){sub_self(fake[r+1], tmp);}
            }
        }
    }
    
    int prefixe_sum = 0;
    for(int i=0; i<=k; i++){
        add_self(prefixe_sum, fake[i]);
        add_self(dp[i], prefixe_sum);
    }
    
    
    printf("%d\n", dp[k]);
}
