#include <bits/stdc++.h>
using namespace std;
long long int dp[100001][101];
int main() {
  long long int n, k;
  cin >> n >> k;
  memset(dp, 0, sizeof dp);
  long long int a[101];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 0; i < n; i++) dp[0][i] = 1;
  long long int sum = a[0];
  for (int i = 0; i <= a[0]; i++) {
    dp[i][0] = 1;
  }
  for (long long int i = 1; i < n; i++) {
    for (long long int j = 1; j <= k; j++) {
      long long int f = 0;
      if (j - 1 - a[i] >= 0) f = dp[j - 1 - a[i]][i];
      dp[j][i] = (dp[j - 1][i] % 1000000007 + dp[i - 1][j] % 1000000007 - f +
                  1000000007) %
                 1000000007;
    }
  }
  cout << dp[k][n - 1] << endl;
}
