#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int n;
int k;
int dp[110][110000];
vector<int> a;
int main() {
  cin >> n >> k;
  a.assign(n + 1, 0);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i <= a[0]; i++) dp[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    for (int j = 0; j <= k; j++) {
      sum += dp[i - 1][j];
      if (j > a[i]) sum -= dp[i - 1][j - a[i] - 1];
      sum %= MOD;
      dp[i][j] = sum % MOD;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
