#include <bits/stdc++.h>
using namespace std;
int N, K;
int a[105];
long long int dp[105][200005];
long long int MOD = 1000000007;
int main(void) {
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
  }
  for (int k = 0; k <= K; k++) {
    dp[0][k] = 1;
  }
  for (int i = 1; i <= N; i++) {
    for (int k = 0; k <= K; k++) {
      dp[i][k] += dp[i - 1][k] - dp[i - 1][k + a[i] + 1];
      dp[i][k] %= MOD;
    }
    for (int k = K; k >= 0; k--) {
      dp[i][k] += dp[i][k + 1];
      dp[i][k] %= MOD;
    }
  }
  long long int ans = dp[N][0] - dp[N][1];
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
