#include <bits/stdc++.h>
using namespace std;
long long dp[100005][105], arr[102], MOD = 1e9 + 7;
signed main() {
  long long n, k, i, j, x;
  memset(dp, 0, sizeof dp);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  for (i = 0; i <= n; i++) dp[0][i] = 1;
  for (i = 1; i <= k; i++) {
    for (j = 1; j <= n; j++) {
      if (i <= arr[j])
        dp[i][j] = dp[i][j - 1];
      else
        dp[i][j] =
            ((dp[i][j - 1] % MOD) - (dp[i - arr[j] - 1][j - 1] % MOD)) % MOD;
      dp[i][j] = ((dp[i][j] % MOD) + (dp[i - 1][j] % MOD)) % MOD;
    }
  }
  cout << dp[k][n] << endl;
  return 0;
}
