#include <bits/stdc++.h>
const int MAXN = 100 + 5, MAXK = 1e5 + 5, MOD = 1e9 + 7;
using namespace std;
int n, k, v[MAXN];
long long dp[MAXN][MAXK], mars[MAXK];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int j = 0; j <= v[1]; j++) dp[1][j] = 1;
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= k; j++) mars[j] = 0;
    for (int j = 0; j <= v[i]; j++) {
      mars[j] += dp[i - 1][j];
      mars[j] %= MOD;
      if (j + v[i] + 1 < MAXK) {
        mars[j + v[i] + 1] -= dp[i - 1][j];
        mars[j + v[i] + 1] %= MOD;
      }
    }
    for (int j = 0; j <= k; j++) {
      mars[j] += mars[j - 1];
      mars[j] %= MOD;
    }
    for (int j = 0; j <= k; j++) dp[i][j] = mars[j];
  }
  cout << (dp[n][k] + MOD) % MOD;
  return 0;
}
