#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
#define REP(i, n) for (int i = 0; i < n; i++)

ll n, k, a[105], dp[105][100005];

int main() {
    cin >> n >> k;
    REP(i,n) cin >> a[i];
    dp[0][k] = 1;
    REP(i,n){
        REP(j,k+1){
            dp[i][j+1] += dp[i][j];
            dp[i][j+1] %= MOD;
        }
        REP(j,k+1){
            dp[i+1][j] += dp[i][min(k,j+a[i])] - (j>0?dp[i][j-1]:0) + MOD;
            dp[i+1][j] %= MOD;
        }
    }
    cout << dp[n][0] << endl;
    return 0;
}
