#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int> ,null_type,less<pair<int,int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
long long MOD = 1e9+7;
pair<int,int> dx[4] = {{1,0},{-1,0},{0,1},{0,-1}};
long long fastpow(long long x,long long k)
{
    if(!k)
        return 1;
    if(k & 1)
        return ((x * fastpow(x,k-1) % MOD) % MOD) % MOD;
    long long ans = fastpow(x,k/2);
    ans %= MOD;
    ans *= ans;
    ans %= MOD;
    return ans;
}
long long sumF(long long x)
{
    int s = 0;
    while(x)
        s += x%10,x /= 10;
    return s;
}
int arr[105];
long long dp[105][100005];
int solve(int idx,int left)
{
    if(idx == 0)
        return left == 0;
    int C = 0;
    for(int i = 0;i <= arr[idx] && i <= left;i++)
        C += solve(idx - 1,left - i);
    return C;
}
int main()
{
    int n,k;
    cin >> n >> k;
    for(int i = 1;i <= n;i++)
        cin >> arr[i];
    dp[0][0] = 1;
    for(int i = 1;i <= n;i++)
    {
        for(int j = 0;j <= k;j++)
        {
            int f1 = j;
            int f2 = j - min(arr[i],j);
            dp[i][j] += dp[i-1][f1] - (f2 ? dp[i-1][f2-1] : 0);
            dp[i][j] %= MOD;
            if(j)
            dp[i][j] += dp[i][j-1];
            dp[i][j] %= MOD;
        }
    }
    cout << dp[n][k];
    return 0;
}
