# pragma GCC optimize("O3")
# include <bits/stdc++.h>
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define rcg(s) cout << s;exit(0)
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define all(s) s.begin(),s.end()
# define sz(x) (int)((x).size())
# define int ll
using namespace std;

int n,k,dp[1 << 17],x;

const int mod = 1e9 + 7;

int32_t main(){_
    //freopen("in","r",stdin);
    cin >> n >> k;
    dp[0] = 1;
    for(int i = 1;i <= n;i++)
    {
        cin >> x;
        for(int val = k;val >= 0;val--)
        {
            dp[val] = (mod + (dp[val] - (val - x - 1 >= 0 ? dp[val - x - 1] : 0)) % mod;
            dp[val] %= mod;
        }
        for(int val = 1;val <= k;val++)
        {
            dp[val] += dp[val - 1];
            dp[val] %= mod;
        }
    }
    rc(dp[k]);
}
