#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
const int mod = 1e9 + 7;
int main() {
  long long sum;
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    dp[i][0] = 1;
  }
  for (int i = 0; i <= arr[0]; i++) dp[0][i] = 1;
  for (int i = 1; i < n; i++) {
    sum = dp[i - 1][0];
    for (int j = 1; j <= k; j++) {
      sum += dp[i - 1][j];
      sum = sum % mod;
      if (j > arr[i]) {
        sum -= dp[i - 1][j - arr[i] - 1];
      }
      dp[i][j] = sum % mod;
    }
  }
  cout << dp[n - 1][k] << endl;
}
