#include <iostream>
using namespace std;
typedef long long ll;
const int MOD = 1000000007; 
int n, k;
int a[110];
ll cum[100010];
ll dp[110][100010];

int main() {
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];

    for (int j = 0; j <= a[0]; j++) dp[1][j] = 1;
    for (int i = 1; i < n; i++) {
        cum[0] = 0;
        for (int j = 0; j <= k; j++) cum[j+1] = (cum[j] + dp[i][j]) % MOD;
        for (int j = 0; j <= k; j++) dp[i+1][j] = (cum[j+1] - cum[max(0, j - a[i])] + MOD) % MOD; 
    }
    cout << dp[n][k] << endl;
}