#include <bits/stdc++.h>
using namespace std;
const long long MAXN = (long long)1e2 + 10;
const long long MAXK = (long long)1e5 + 10;
const long long MOD = (long long)1e9 + 7;
long long n, k, a[MAXN];
long long memo[MAXN][MAXK], prefix[MAXK];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 0; i <= n; i++) memo[i][0] = 1;
  for (long long j = 0; j <= k && j <= a[1]; j++) memo[1][j] = 1;
  prefix[0] = memo[1][0];
  for (long long j = 1; j <= k; j++) prefix[j] = memo[1][j] + prefix[j - 1];
  for (long long i = 2; i <= n; i++) {
    for (long long j = 1; j <= k; j++) {
      if (j <= a[i])
        memo[i][j] = prefix[j];
      else
        memo[i][j] = prefix[j] - prefix[j - a[i] - 1];
    }
    prefix[0] = memo[i][0] % MOD;
    for (long long j = 1; j <= k; j++)
      prefix[j] = (memo[i][j] % MOD + prefix[j - 1]) % MOD;
  }
  cout << memo[n][k] << endl;
  return 0;
}
