#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    int dp[200][100006];
    int candy(int n , int k , int *arr){
        if(n==1  and arr[n]>k)return 0;
        if(n==1 and arr[n]<k)return 1;
        if(k<0)return 0;
        if(dp[n][k]!=-1)return dp[n][k];
        if((k-1-a[n])>=0){
        return dp[n][k]=(candy(a,n,k-1)  + candy(a,n-1,k) -     (candy(a,n-1,k-1-a[n]))  )  %1000000007;}
        else return dp[n][k]=(candy(a,n,k-1)  + candy(a,n-1,k)  )  %1000000007;}
    }
    signed main(){
       int n;cin>>n;
       int k;cin>>k;
       memset(dp , -1 , sizeof dp);
       int arr[n];forr(i,1,n+1)cin>>arr[i];
       cout<<candy(n,k,arr);
         }
    