#include <iostream>

using namespace std;

const int M = 1e9+7;
int n, k, a[100100], dp[110][100100];

int main()
{
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];

  dp[0][0] = 1;

  for (int i = 0; i < n; i++) {
    long long sum = 0;
    for (int j = 0; j <= k; j++) {
      sum += dp[i][j];
      if (j-a[i]-1 >= 0) sum -= dp[i][j-a[i]-1]-M;
      sum %= M;
      dp[i+1][j] = sum;
    }
  }

  cout << dp[n][k] << endl;
  return 0;
}