#include <bits/stdc++.h>
using namespace std;
long long dp[100][100001] = {};
int main() {
  long long N, K;
  cin >> N >> K;
  long long a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    dp[i][0] = 1;
  }
  for (int j = 1; j <= min(K, a[0]); j++) {
    dp[0][j] = 1;
  }
  for (int i = 1; i < N; i++) {
    for (int j = 1; j <= K; j++) {
      if (j > a[i]) {
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1 - a[i]];
      } else {
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
      }
      dp[i][j] %= 1000000007;
    }
  }
  cout << dp[N - 1][K] << endl;
  return 0;
}
