#include <bits/stdc++.h>

using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
int dp[111][100100];
int a[111](
const int mod = 1000000007;
signed main()
{
  int N, K;
  cin >> N >> K;
  rep(i, N) cin >> a[i];
  dp[0][0] = 1;
  rep(i, N) {
    rep(j, K+1) {
      dp[i+1][j] += dp[i][j];
      dp[i+1][min(j+a[i]+1, K+1)] -= dp[i][j];
    }
    rep(j, K) {
      dp[i+1][j+1] += dp[i+1][j];
      dp[i+1][j+1] %= mod;
    }
  }
  cout << dp[N][K] << endl;
}