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