#include <bits/stdc++.h>
using namespace std;
mt19937_64 mrand(random_device{}());
const int mod = 1e9 + 7;
const int N = 110;
const int M = 1e5 + 10;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline long long Pow(long long a, long long b) {
  long long ans = 1;
  for (; b; b >>= 1) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
  }
  return ans;
}
inline long long Mul(long long a, long long b) {
  long long lf = a * (b >> 25ll) % mod * (1LL << 25) % mod;
  long long rg = a * (b & ((1ll << 25) - 1)) % mod;
  return (lf + rg) % mod;
}
inline long long C(long long y, long long x) {
  long long ans = 1;
  if (y < 0 || x < 0 || y < x) return 0;
  y %= mod;
  if (!y || !x) return 1;
  for (int i = 0; i <= x - 1; ++i) ans = ans * (y - i) % mod;
  for (int i = 1; i <= x; ++i) ans = ans * Pow(i, mod - 2) % mod;
  return ans;
}
int n, k, a[N];
long long dp[M], sum[M];
int main() {
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) {
    memset(sum, 0, sizeof(sum));
    for (int j = 0; j <= k; ++j) {
      int l = j + 1, r = j + min(k - j, a[i]);
      if (l > r) break;
      sum[l] = (sum[l] + dp[j]) % mod;
      sum[r + 1] -= dp[j];
    }
    for (int j = 1; j <= k; ++j) {
      sum[j] = (sum[j] + sum[j - 1]) % mod;
      dp[j] = (dp[j] + sum[j]) % mod;
    }
  }
  printf("%lld\n", dp[k]);
  return 0;
}
