#include <bits/stdc++.h>
using namespace std;
int mod(const int& a) {
  if (a >= 0) return a % 1000000007;
  return mod(a + 1000000007);
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[100];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i + 1];
    cnt += a[i + 1];
  }
  int dp[101][100001] = {};
  for (int i = 0; i <= k; i++) {
    dp[0][i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j) dp[i][j] = dp[i][j - 1];
      dp[i][j] = mod(
          dp[i][j] +=
          (dp[i - 1][j] - ((j - a[i] - 1) >= 0 ? dp[i - 1][j - a[i] - 1] : 0)));
    }
  }
  cout << mod(dp[n][k] - dp[n][k - 1]) << endl;
}
