#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005], n, k, arr[100005], sum[100005];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    sum[0] = dp[i - 1][0];
    for (int j = 1; j <= k; j++)
      sum[j] = (sum[j - 1] + dp[i - 1][j]) % 1000000007;
    for (int j = 1; j <= k; j++) {
      long long idx = j - arr[i] - 1;
      long long rm = (idx < 0 ? 0 : sum[idx]) % 1000000007;
      dp[i][j] = (dp[i][j] + sum[j] - rm) % 1000000007;
    }
  }
  cout << dp[n][k] << endl;
}
