#include <bits/stdc++.h>
using namespace std;
pair<int, int> dirs[] = {{1, 2},  {-1, 2},  {2, 1},  {2, -1},
                         {-2, 1}, {-2, -1}, {1, -2}, {-1, -2}};
long long mod = 1e9 + 7;
long double eps = 1e-6;
long long dp[107][100007], accumDP[107][100007];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long arr[107];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i <= n; i++) {
    accumDP[i][0] = 1;
  }
  for (int i = 0; i <= k; i++) {
    accumDP[0][i] = 1;
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j == 0) {
        dp[i][j] = 1;
        continue;
      }
      if (i == 0) {
        dp[i][j] = 0;
        continue;
      }
      long long sum = accumDP[i - 1][j];
      if (j - arr[i] - 1 >= 0) {
        sum -= accumDP[i - 1][j - arr[i] - 1];
      }
      dp[i][j] = sum % mod;
      accumDP[i][j] = ((dp[i][j] % mod) + (accumDP[i][j - 1] % mod)) % mod;
    }
  }
  cout << dp[n][k] % mod;
}
