#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long MOD = 1E+09 + 7;
const long long INF = 1E18;
const int MAX_N = 100;
const int MAX_K = 1E+05;
int N, K;
long long A[MAX_N + 1], dp[MAX_N + 1][MAX_K + 1];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> K;
  for (int i = 1; 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][j - 1] + dp[i - 1][j]) % MOD;
      if (j - 1 >= A[i]) {
        dp[i][j] = (dp[i][j] - dp[i - 1][j - 1 - A[i]]) % MOD;
      }
    }
  }
  cout << dp[N][K] << "\n";
  return 0;
}
