#include <bits/stdc++.h>
using namespace std;
long long N, K;
long long pref[100010];
long long currpref[100010];
long long dp[110][100010];
long long a[100010];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> K;
  for (long long i = 1; i <= N; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (long long i = 0; i <= K; i++) {
    pref[i + 1] = (pref[i + 1] + pref[i]) % 1000000007;
    pref[i + 1] = (pref[i + 1] + dp[0][i]) % 1000000007;
  }
  for (long long i = 1; i <= N; i++) {
    for (long long j = 0; j <= K; j++) {
      dp[i][j] = (pref[j + 1] - pref[max((long long)0, j - a[i])]) % 1000000007;
      currpref[j + 1] = (currpref[j + 1] + currpref[j]) % 1000000007;
      currpref[j + 1] = (currpref[j + 1] + dp[i][j]) % 1000000007;
    }
    memcpy(pref, currpref, sizeof(pref));
    memset(currpref, 0, sizeof(currpref));
  }
  cout << dp[N][K] % 1000000007 << endl;
  return 0;
}
