#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long dp[101][100001];
long long ruisekiwa[101][100002];
int N, K;
int A[101];
int main() {
  cin >> N >> K;
  for (int i = 1; i <= N; i++) cin >> A[i];
  ruisekiwa[0][0] = 0;
  for (int i = 1; i <= K + 1; i++) {
    ruisekiwa[0][i] = 1;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= K; j++) {
      int ulimit = max(0, j - A[i]);
      dp[i][j] = ruisekiwa[i - 1][j + 1] - ruisekiwa[i - 1][ulimit];
      dp[i][j] %= MOD;
      ruisekiwa[i][j + 1] = ruisekiwa[i][j] + dp[i][j];
      ruisekiwa[i][j + 1] %= MOD;
    }
  }
  cout << dp[N][K] % MOD << endl;
  return 0;
}
