#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, k;
  cin >> n >> k;
  long long int arr[n + 1];
  for (long long int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  long long int dp[n + 1][k + 1];
  for (long long int i = 0; i <= k; i++) {
    dp[1][i] = (i <= arr[1] ? 1 : 0);
  }
  for (long long int i = 2; i <= n; i++) {
    for (long long int j = 0; j <= k; j++) {
      if (j == 0)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] -
                    ((j - arr[i] - 1 >= 0) ? dp[i - 1][j - arr[i] - 1] : 0)) %
                   1000000007;
    }
  }
  cout << dp[n][k];
}
int main() {
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
