#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7, dp[103][100010];
int n, K, a[103];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> K;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i <= a[0]; i++) dp[0][i] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= K; j++) {
      dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
      if (j - a[i] - 1 >= 0) dp[i][j] -= dp[i - 1][j - a[i] - 1];
      dp[i][j] %= mod;
    }
    for (int j = 1; j <= K; j++) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
  }
  cout << dp[n - 1][K] % mod;
  return 0;
}
