#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e9 + 5;
long long powmod(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = (ret * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ret;
}
const int maxn = 105;
int n, k;
int a[maxn];
long long dp[maxn][100005];
long long ps[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i <= n - 1; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= a[0]; i++) {
    dp[0][k - i] = 1;
    ps[0] = dp[0][0];
    for (int j = 1; j <= k; j++) {
      ps[j] = (ps[j - 1] + dp[0][j]) % mod;
    }
  }
  for (int i = 1; i <= n - 1; i++) {
    for (int j = 0; j <= k; j++) {
      int l = j;
      int r = min(j + a[i], k);
      if (l > 0)
        dp[i][j] = (ps[r] - ps[l - 1]) % mod;
      else
        dp[i][j] = ps[r] % mod;
    }
    for (int i = 0; i <= 100004; i++) ps[i] = 0;
    ps[0] = dp[i][0];
    for (int j = 1; j <= k; j++) ps[j] = (dp[i][j] + ps[j - 1]) % mod;
  }
  long long res = dp[n - 1][0];
  cout << res << "\n";
  return 0;
}
