#include <bits/stdc++.h>
const int N = 1e2 + 10;
const int K = 1e5 + 10;
const int MOD = 1e9 + 7;
long long int s[N][K], f[N][K];
int main() {
  int n, k, a[N];
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= k; j++) f[i][j] = s[i][j] = 0;
  f[0][0] = s[0][0] = 1;
  for (int i = 1; i <= k; i++) s[0][i] = (s[0][i - 1] + f[0][i]) % MOD;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    for (int j = 0; j <= k; j++) {
      if (a[i] >= j)
        f[i][j] = s[i - 1][j];
      else
        f[i][j] = s[i - 1][j] - s[i - 1][j - a[i] - 1];
      f[i][j] %= MOD;
    }
    s[i][0] = 1;
    for (int j = 1; j <= k; j++) s[i][j] = (s[i][j - 1] + f[i][j]) % MOD;
  }
  printf("%lld\n", f[n][k]);
}
