#include <bits/stdc++.h>
using namespace std;
long long INFL = 1000000000000000010;
int INF = 2000000000;
long long MOD = 1000000007;
long long dp[110][100010];
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < 110; i++) {
    dp[i][0] = 1;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 1; j <= K; j++) {
      if (j - a.at(i) - 1 >= 0) {
        dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j] - dp[i][j - a.at(i) - 1];
      } else {
        dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j];
      }
      dp[i + 1][j] %= MOD;
    }
  }
  cout << dp[N][K] << endl;
}
