#include <bits/stdc++.h>
using namespace std;
int const N = 100;
int const K = 100001;
unsigned long long const MOD = 1000000007;
unsigned long long ways[N][K];
int limit[N];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> limit[i];
  for (int i = 0; i <= k; i++) {
    if (limit[0] >= i)
      ways[0][i] = 1;
    else
      ways[0][i] = 0;
  }
  for (int i = 0; i < k; i++) {
    ways[i][0] = 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      if (limit[i] >= j)
        ways[i][j] = ways[i - 1][j] + ways[i][j - 1];
      else
        ways[i][j] = ways[i - 1][j] + ways[i][j - 1] +
                     (MOD - ways[i - 1][j - limit[i] - 1]);
      ways[i][j] %= MOD;
    }
  }
  cout << ways[n - 1][k] << '\n';
}
