#include <bits/stdc++.h>
using namespace std;
const int SIZE1 = 103;
const int SIZE2 = 1e5 + 120;
const int MOD = 1e9 + 7;
int kids[SIZE1];
int dp[SIZE1][SIZE2];
int pom[SIZE1][SIZE2];
int n, k;
void input() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> kids[i];
}
void preproces() {
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
    pom[i][0] = 1;
  }
  for (int i = 0; i <= k; i++) pom[0][i] = 1;
}
void debug() {
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) cout << pom[i][j] << " ";
    cout << "\n";
  }
  cout << "\n"
       << "\n";
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) cout << dp[i][j] << " ";
    cout << "\n";
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  input();
  preproces();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j - kids[i] <= 0)
        dp[i][j] = pom[i - 1][j];
      else
        dp[i][j] = (pom[i - 1][j] - pom[i - 1][j - kids[i] - 1]) % MOD;
    }
    for (int j = 1; j <= k; j++) pom[i][j] = (pom[i][j - 1] + dp[i][j]) % MOD;
  }
  return cout << dp[n][k] % MOD, 0;
}
