#include <bits/stdc++.h>
using namespace std;
long long n, k, ind, arr[105], m = 1e9 + 7, dp[105][100005];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 0; i <= k; i++) {
    if (arr[1] >= i) dp[1][i] = 1;
    if (i && n != 1) dp[1][i] = (dp[1][i] + dp[1][i - 1]) % m;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      ind = j - arr[i] - 1;
      if (ind < 0)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = (dp[i - 1][j] - dp[i - 1][ind]) % m;
      if (j && i != n) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % m;
    }
  }
  cout << dp[n][k] << "\n";
  return 0;
}
