#include <bits/stdc++.h>
using namespace std;
long long int arr[105], dp[105][100005];
void solve(long long int caseno) {
  long long int i, j, n, k;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> arr[i];
  for (i = 0; i < k + 1; i++) dp[0][i] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= k; j++) {
      long long int mn = j - arr[i] - 1;
      dp[i][j] = dp[i - 1][j];
      if (mn >= 0) dp[i][j] -= dp[i - 1][mn];
      dp[i][j] %= 1000000007;
    }
    if (i == n) {
      cout << dp[n][k] << '\n';
      return;
    }
    for (j = 1; j <= k; j++) {
      dp[i][j] += dp[i][j - 1];
      dp[i][j] %= 1000000007;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  for (long long int i = 1; i <= t; i++) {
    solve(i);
  }
  return 0;
}
