#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> dp[101][100001];
long long solve_ite(int* a, int n, int total_candies) {
  for (int child = n - 1; child >= 0; child--) {
    for (int candies_left = 0; candies_left <= total_candies; candies_left++) {
      if (candies_left > a[child])
        dp[child][candies_left].first =
            dp[child + 1][candies_left].second -
            dp[child + 1][candies_left - a[child] - 1].second;
      else
        dp[child][candies_left].first = dp[child + 1][candies_left].second;
      if (candies_left > 0)
        dp[child][candies_left].second =
            dp[child][candies_left - 1].second + dp[child][candies_left].first;
      else
        dp[child][candies_left].second = dp[child][candies_left].first;
      dp[child][candies_left].first %= 1000000007;
      dp[child][candies_left].second %= 1000000007;
    }
  }
  return dp[0][total_candies].first;
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < 101; ++i) {
    for (int j = 0; j < 100001; ++j) {
      dp[i][j].first = 0;
      dp[i][j].second = 0;
    }
  }
  dp[n][0].first = 1;
  dp[n][0].second = 1;
  for (int i = 0; i <= k; ++i) {
    dp[n][i].second = 1;
  }
  cout << solve_ite(a, n, k);
  return 0;
}
