#include <bits/stdc++.h>
using namespace std;
long long dp[100010], bm[100010], ara[100010], n, k;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i <= n - 1; i++) cin >> ara[i];
  dp[0] = 1;
  for (int i = 0; i <= n - 1; i++) {
    for (int j = 0; j <= k; j++) {
      int l = j, r = j + ara[i] + 1;
      r = min(r, 100010 - 1);
      bm[l] += dp[j];
      if (bm[l] >= 1000000007) bm[l] -= 1000000007;
      if (bm[l] < dp[j]) bm[l] -= 1000000007;
      bm[r] -= dp[j];
      if (bm[r] >= 1000000007) bm[r] -= 1000000007;
    }
    for (int j = 1; j <= k; j++) {
      bm[j] += bm[j - 1];
      if (bm[j] >= 1000000007) bm[j] -= 1000000007;
    }
    for (int j = 0; j <= k; j++) {
      dp[j] = bm[j];
      bm[j] = 0;
    }
  }
  cout << dp[k] << endl;
  return 0;
}
