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