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