#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int r = 1;
  x = x % p;
  while (y) {
    if (y & 1) r = r * x % p;
    y = y >> 1;
    x = x * x % p;
  }
  return r;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l = 0, int r = 1e9) {
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}
const int N = 1e5 + 99;
int n, k;
int a[N], dp[N][105], pf[N][105];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i <= k; i++) pf[i][0] = 1;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[j][i] = (pf[j][i - 1]);
      if (j - a[i] - 1 >= 0)
        dp[j][i] =
            (dp[j][i] - pf[j - a[i] - 1][i - 1] + 1000000007) % 1000000007;
      pf[j][i] = (dp[j][i] + pf[j - 1][i]) % 1000000007;
    }
  }
  cout << dp[k][n] << '\n';
}
