#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int M = 100010;
const int mod = 1000000007;
int dp[N][M];
int a[N], n, sum;

int main() {
    cin >> n >> sum;
    for(int i = 1; i <= n; i ++) cin >> a[i];
    for(int i = 0; i <= n; i ++) dp[i][0] = 1;
    for(int i = 1; i <= n; i ++) {
        for(int j = 1; j <= sum; j ++) {
            dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod;
            if(j > a[i]) dp[i][j] = (dp[i][j] - dp[i-1][j-a[i]-1] + mod) % mod;
        }
    }
    cout << dp[n][sum] << endl;
    return 0;
}
