#include <bits/stdc++.h>
using namespace std;
long long int n, m;
long long int arr[105];
long long int dp[105][100006];
long long int prefix[105][100006];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k, c = 0, ans = 0, t, z, x = 0, y;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  dp[0][0] = 1;
  for (j = 0; j <= k; j++) {
    prefix[0][j] = 1;
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= k; j++) {
      if (j == 0) {
        dp[i][j] = dp[i - 1][j];
        dp[i][j] %= 1000000007;
        prefix[i][j] = 1;
        prefix[i][j] %= 1000000007;
      } else {
        long long int l = max(0LL, arr[i - 1] + 1);
        dp[i][j] = prefix[i - 1][j] - prefix[i - 1][j - l];
        dp[i][j] %= 1000000007;
        prefix[i][j] = prefix[i][j - 1] + dp[i][j];
        prefix[i][j] %= 1000000007;
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
