#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int K = 1e5 + 100;
const int Mod = 1e9 + 7;
int Arr[N];
int Dp[2][K];
int Prefix[2][K];
void CalcPrefix(int row, int k) {
  Prefix[row][0] = Dp[row][0];
  for (int i = 1; i <= k; i++)
    Prefix[row][i] = (Prefix[row][i - 1] + Dp[row][i]) % Mod;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", Arr + i);
  Dp[n & 1][0] = 1;
  for (int child = n - 1; ~child; child--) {
    CalcPrefix((child + 1) & 1, k);
    for (int candie = 0; candie <= k; candie++) {
      int L = max(0, candie - Arr[child]), R = candie;
      Dp[child & 1][candie] =
          Prefix[(child + 1) & 1][R] - (L ? Prefix[(child + 1) & 1][L - 1] : 0);
    }
  }
  printf("%d\n", Dp[0][k]);
  return 0;
}
