#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= K; j++) {
      if (j == 0)
        dp[i][j] = 1;
      else if (j - a[i - 1] - 1 >= 0) {
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - a[i - 1] - 1];
      } else {
        dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
      }
      dp[i][j] %= 1000000007LL;
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
