#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long N, K, a[101], dp[101][100001], prefix[101][100001];
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  prefix[0][0] = dp[0][0] = 1;
  for (int j = 1; j <= K; j++) {
    if (j <= a[0]) {
      dp[0][j] = 1;
    }
    prefix[0][j] = prefix[0][j - 1] + dp[0][j];
  }
  for (int i = 1; i < N; i++) {
    for (int j = 0; j <= K; j++) {
      if (j - a[i] - 1 >= 0) {
        dp[i][j] = prefix[i - 1][j] - prefix[i - 1][j - a[i] - 1];
      } else {
        dp[i][j] = prefix[i - 1][j];
      }
      dp[i][j] %= MOD;
      if (j == 0) {
        prefix[i][j] = 1;
      } else {
        prefix[i][j] = prefix[i][j - 1] + dp[i][j];
      }
      prefix[i][j] %= MOD;
    }
  }
  cout << dp[N - 1][K] << "\n";
}
