#include <bits/stdc++.h>
using namespace std;
long long int a[105];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i + 1];
  vector<long long int> prefix(k + 1, 1);
  long long int dp[n + 1][k + 1];
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= k; j++) dp[i][j] = 0;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    vector<long long int> pre(k + 1);
    for (int p = 0; p <= k; p++) {
      if (p - a[i] - 1 < 0)
        dp[i][p] = prefix[p];
      else {
        dp[i][p] = (prefix[p] - prefix[p - a[i] - 1] + 1000000007) % 1000000007;
      }
      if (p > 0)
        pre[p] = (dp[i][p] + pre[p - 1]);
      else
        pre[p] = 1;
    }
    prefix = pre;
  }
  cout << dp[n][k];
}
