/*
I am not the only traveler
Who has not repaid his debt
I've been searching for a trail to follow again
Take me back to the night we met
And then I can tell myself
What the hell I'm supposed to do
And then I can tell myself
Not to ride along with you
I had all and then most of you
Some and now none of you
Take me back to the night we met
I don't know what I'm supposed to do
Haunted by the ghost of you
Oh, take me back to the night we met
When the night was full of terrors
And your eyes were filled with tears
When you had not touched me yet
Oh, take me back to the night we met
I had all and then most of you
Some and now none of you
Take me back to the night we met
I don't know what I'm supposed to do
Haunted by the ghost of you
Take me back to the night we met
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define int               long long
#define fr                first
#define sc                second
#define vc                vector
#define endl              '\n'
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define LSB(i)            ((i)&-(i))

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 1e5 + 5;
const int M = 105;
int dp[M][N];
int n, k;
int a[N];
int mod = 1e9 + 7;

int dynamic(int pos, int candies) {
    if (candies == 0)return 1;
    if (candies < 0 || pos < 0)return 0;
    if (dp[pos][candies] != -1)return dp[pos][candies];
    int ans = 0;
    for (int i = 0; i <= a[pos]; i++) {
        ans = (ans + dynamic(pos - 1, candies - i)) % mod;
    }
    dp[pos][candies] = ans;
    return ans;
}

void solve()
{
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << dynamic(n - 1, k);
}
signed main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while (t--) solve();
    return 0;
}