#include <bits/stdc++.h>
using namespace std;
int N, K, a[100];
long long dp[101][100001] = {};
long long wa[101][100002] = {};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(9);
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i <= K; i++) wa[0][i + 1] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= K; j++) {
      dp[i][j] = wa[i - 1][j + 1] - wa[i - 1][max(0, j - a[i - 1])];
      dp[i][j] %= 1000000000 + 7;
      wa[i][j + 1] = wa[i][j] + dp[i][j];
      wa[i][j + 1] %= 1000000000 + 7;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
