#include <bits/stdc++.h>
using namespace std;
long long int cache[105][100005];
int main() {
  long long int mod = pow(10, 9) + 7;
  long int k, n;
  cin >> n >> k;
  long long int a[n];
  long int i, j;
  for (i = 0; i < n; i++) cin >> a[i];
  memset(cache, 0, sizeof(cache));
  for (int i = 0; i <= k; i++) {
    if (a[0] >= i)
      cache[0][i] = 1;
    else
      break;
  }
  for (i = 0; i < n; i++) cache[i][0] = 1;
  long long int sum = a[0];
  for (i = 1; i < n; i++) {
    sum += a[i];
    j = 1;
    while (j <= k && j <= sum) {
      if (j - a[i] - 1 >= 0) {
        cache[i][j] = (cache[i - 1][j] % mod + cache[i][j - 1] % mod -
                       cache[i][j - a[i] - 1] % mod) %
                      mod;
      } else
        cache[i][j] = (cache[i - 1][j] % mod + cache[i][j - 1] % mod) % mod;
      j++;
    }
  }
  cout << cache[n - 1][k] % mod;
}
