#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int lim = 1e5 + 5;
int n, k;
int arr[102];
int dp[102][lim];
int solve(int pos, int k) {
  int ub = k;
  int lb = max(0, k - arr[pos]);
  int ans = dp[pos + 1][ub];
  if (lb > 0) ans -= dp[pos + 1][lb - 1];
  return (ans % mod + mod) % mod;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  memset(dp, 0, sizeof dp);
  for (int i = n - 1; i >= 0; --i)
    for (int j = 0; j <= k; ++j) {
      if (j == 0)
        dp[i][j] = 1;
      else if (i == n - 1) {
        dp[i][j] += dp[i][j - 1];
        if (j <= arr[i]) dp[i][j] += 1;
        dp[i][j] %= mod;
      } else
        dp[i][j] = (dp[i][j - 1] + solve(i, j)) % mod;
    }
  cout << solve(0, k);
  return 0;
}
