#include <bits/stdc++.h>
using namespace std;
int arr[105];
long dp[105][100005];
long pref[105][100005];
const long MOD = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i < n + 1; i++) cin >> arr[i];
  for (int i = 0; i < n + 1; i++) {
    pref[i][0] = 0;
    dp[i][1] = 1;
    pref[i][1] = 1;
  }
  for (int i = 2; i < k + 2; i++) {
    dp[0][i] = 0;
    pref[0][i] = 1;
  }
  for (int i = 1; i < n + 1; i++) {
    for (int j = 2; j < k + 2; j++) {
      dp[i][j] = pref[i - 1][j] - pref[i - 1][max(0, j - arr[i] - 1)];
      dp[i][j] %= MOD;
      pref[i][j] = pref[i][j - 1] + dp[i][j];
      pref[i][j] %= MOD;
    }
  }
  cout << dp[n][k + 1] << endl;
  return 0;
}
