#include <bits/stdc++.h>
using namespace std;
const int MAXN = 102, MAXK = 1e5 + 2, MOD = 1e9 + 7;
int N, K, cur, dp[MAXK], diff[MAXK];
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cin >> N >> K;
  dp[0] = 1;
  for (int i = 0, a; i < N; i++) {
    memset(diff, 0, sizeof(diff));
    cin >> a;
    for (int j = 0; j <= min(cur, K - 1); j++) {
      diff[j + 1] += dp[j];
      diff[min(K + 1, j + a + 1)] -= dp[j];
    }
    int pre = 0;
    for (int j = 0; j <= K; j++) {
      pre = (pre + diff[j]) % MOD;
      ;
      dp[j] = (dp[j] + pre) % MOD;
    }
    cur = min(K, cur + a);
  }
  cout << dp[K] << '\n';
  return 0;
}
