#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<int> prefix(k + 1, 1);
  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<int> pre(k + 1);
    for (int j = 0; j <= k; j++) {
      int tr = prefix[j];
      int unreachable = j - a[i] - 1;
      if (unreachable >= 0) {
        tr = (tr - prefix[unreachable] + 1000000007) % 1000000007;
      }
      dp[i][j] = tr;
      if (j > 0)
        pre[j] = (pre[j - 1] + dp[i][j]);
      else
        pre[j] = 1;
    }
    prefix = pre;
  }
  cout << dp[n][k];
}
