#include <bits/stdc++.h>
using namespace std;
double dp[301][301][301];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long dp[k + 1][n];
  memset(dp, 0, sizeof(dp));
  for (long long i = 0; i <= k; i++) {
    if (arr[n - 1] - i >= 0) dp[i][n - 1] = 1;
  }
  for (long long i = n - 2; i >= 0; i--) {
    for (long long j = 0; j <= k; j++) {
      if (j > 0) {
        dp[j][i] = dp[j - 1][i];
        if (j - 1 - arr[i] >= 0) dp[j][i] -= dp[j - 1 - arr[i]][i + 1];
      }
      if (dp[j][i + 1] > 0) dp[j][i] += dp[j][i + 1];
      dp[j][i] %= 1000000007;
    }
  }
  cout << dp[k][0];
  return 0;
}
