#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
}
long long dp[110][100010];
long long mod_num = 1e9 + 7;
long long a[100010];
long long solve(int i, int j) {
  if (j == 0) return 1;
  if (j < 0) return 0;
  if (i == -1) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  return dp[i][j] = (solve(i - 1, j) + solve(i, j - 1)) % mod_num -
                    (mod_num + solve(i - 1, j - a[i - 1] - 1)) % mod_num;
}
int main() {
  int n, k;
  cin >> n >> k;
  for (long long i = 0; i < (long long)(n); ++i) cin >> a[i];
  for (long long i = (0); i <= (long long)(n); ++i)
    for (long long j = (0); j <= (long long)(k); ++j) dp[i][j] = -1;
  cout << solve(n, k) << endl;
  return 0;
}
