#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int tab[107];
long long dp[107][100007];
int main() {
  int N, K;
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> tab[i];
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    int x = 0;
    for (int j = 0; j <= K; j++) {
      if (j > tab[i]) {
        dp[i][j] = (dp[i][j - 1] - dp[i - 1][j - tab[i] - 1] + mod) % mod;
      } else {
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
      }
    }
  }
  cout << dp[N][K];
}
