#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
long long mod = 1e9 + 7;
int main(int argc, char *argv[]) {
  int N, K, a[100005];
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= N; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= K; j++) {
      dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
      if (j - a[i - 1] - 1 >= 0) {
        dp[i][j] = (dp[i][j] % mod - dp[i - 1][j - a[i - 1] - 1]) % mod;
      }
    }
  }
  cout << dp[N][K] % mod << endl;
  return 0;
}
