#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
long long dp[101][100010];
long long n, k;
long long a[101];
long long rec(long long i, long long num) {
  if (dp[i][num] != -1) return dp[i][num];
  if (i == n - 1) {
    if (num > a[i])
      return dp[i][num] = 0;
    else
      return dp[i][num] = 1;
  }
  long long res = 0;
  for (int j = 0; j < ((int)a[i] + 1); j++)
    res = (res + rec(i + 1, num - j)) % MOD;
  return dp[i][num] = res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < ((int)n); i++) cin >> a[i];
  for (int i = 0; i < ((int)n + 1); i++)
    for (int j = 0; j < ((int)k + 1); j++) dp[i][j] = 0;
  for (long long i = n - 1; i >= 0; i--) {
    vector<long long> cum(k + 3);
    if (i != n - 1) {
      for (int num = 0; num < ((int)k + 1); num++)
        cum[num + 1] = (cum[num] + dp[i + 1][num]) % MOD;
    }
    for (long long num = 0; num <= k; num++) {
      if (i == n - 1) {
        if (num > a[i])
          dp[i][num] = 0;
        else
          dp[i][num] = 1;
      } else {
        dp[i][num] = (cum[num + 1] - cum[max(0LL, num - a[i])]) % MOD;
      }
    }
  }
  long long ans = dp[0][k];
  cout << ans << endl;
}
