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