#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int siz = 1e5 + 7;
int n, K;
int tab[siz];
long long dp[107][siz];
long long pref[107][siz];
int main() {
  scanf("%d %d", &n, &K);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tab[i]);
  }
  dp[0][0] = 1LL;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = 1LL;
    for (int k = 1; k <= K; k++) {
      dp[i][k] = (pref[i - 1][k] - pref[i - 1][max(0, k - tab[i] - 1)]) % mod;
      if (k <= tab[i]) dp[i][k]++;
    }
    pref[i][0] = 1LL;
    for (int k = 1; k <= K; k++) {
      pref[i][k] = (pref[i][k - 1] + dp[i][k]) % mod;
    }
  }
  printf("%lld\n", dp[n][K] % mod);
  return 0;
}
