#include <bits/stdc++.h>
using namespace std;
long long dp[111][100100];
long long a[111];
const long long mod = 1000000007;
signed main() {
  long long N, K;
  cin >> N >> K;
  for (long long i = 0; i < N; i++) cin >> a[i];
  dp[0][0] = 1;
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < K + 1; j++) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][min(j + a[i] + 1, K + 1)] -= dp[i][j];
    }
    dp[i + 1][0] %= mod;
    for (long long j = 0; j < K; j++) {
      dp[i + 1][j + 1] += dp[i + 1][j];
      dp[i + 1][j + 1] %= mod;
    }
  }
  cout << dp[N][K] << endl;
}
