#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long N, K, a[110], dp[110][100100];
signed main() {
  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; j++) {
      long long k;
      if (j - a[i] - 1 < 0) {
        k = 0;
      } else {
        k = dp[i][j - a[i] - 1];
      }
      dp[i + 1][j] = dp[i][j] - k;
      if (j > 0) {
        dp[i + 1][j] += dp[i + 1][j - 1];
      }
      dp[i + 1][j] %= mod;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
