#include <bits/stdc++.h>
using namespace std;
long long n, k, a[110], dp[110][100010], pref[110][100010], mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(dp, 0, sizeof(dp));
  memset(pref, 0, sizeof(pref));
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= k; i++) {
    dp[0][k] = 0;
  }
  for (int i = 1; i <= n; i++) {
    pref[i - 1][0] = 1;
    for (int j = 1; j <= k; j++) {
      pref[i - 1][j] = pref[i - 1][j - 1] + dp[i - 1][j];
      pref[i - 1][j] %= mod;
    }
    for (int j = 0; j <= k; j++) {
      dp[i][j] += pref[i - 1][j] - pref[i - 1][j - min((long long)j, a[i]) - 1];
      dp[i][j] %= mod;
    }
  }
  cout << dp[n][k] << endl;
}
