#include <bits/stdc++.h>
using namespace std;
long long int dp[101][10001], kp[101][10001];
int main() {
  for (int i = 0; i <= 100; i++) {
    for (int j = 0; j <= 10000; j++) {
      dp[i][j] = 0;
      kp[i][j] = 0;
    }
  }
  long long int n, k;
  cin >> n >> k;
  long long int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= k; i++) {
    dp[0][i] = 0;
  }
  dp[0][0] = 1;
  for (long long int i = 1; i <= n; i++) {
    int sums[k + 1];
    sums[0] = dp[i - 1][0];
    for (int j = 1; j <= k; j++) {
      sums[j] = (sums[j - 1] + dp[i - 1][j]) % 1000000007;
    }
    for (long long int j = 0; j <= k; j++) {
      long long int ans = sums[j];
      long long int tr = j - a[i] - 1;
      if (tr >= 0) {
        ans = (ans - sums[tr] + 1000000007) % 1000000007;
      }
      dp[i][j] = ans;
    }
  }
  cout << dp[n][k] << endl;
}
