#include <bits/stdc++.h>
using namespace std;
long long dp[110][100010];
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, K;
  cin >> N >> K;
  long long a[110];
  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 + 1][j - 1] + dp[i][j];
      if (j - 1 - a[i] >= 0) {
        dp[i + 1][j] -= dp[i][j - 1 - a[i]];
      }
      dp[i + 1][j] %= 1000000007;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
