#include <bits/stdc++.h>
using namespace std;
int N, K;
const long long mod = 1e9 + 7;
long long a[101];
long long dp[2][100005];
int main() {
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> a[i];
  dp[1][0] = 1;
  for (int i = 1; i <= N; i++) {
    dp[0][0] = dp[1][0];
    for (int j = 1; j <= K; j++) dp[0][j] = (dp[0][j - 1] + dp[1][j]) % mod;
    memset(dp[1], 0, sizeof(dp[1]));
    for (int j = K; j >= 0; j--) {
      if (j - a[i] > 0) {
        dp[1][j] = (dp[1][j] + dp[0][j] - dp[0][j - a[i] - 1]) % mod;
      } else {
        dp[1][j] = (dp[1][j] + dp[0][j]) % mod;
      }
    }
  }
  cout << dp[1][K] << endl;
}
