#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const long long MOD = 1e9 + 7;
const long long N = 1e5 + 5;
const long long maxN = 3e3 + 5;
const long long MAX_SIZE = 2e6 + 6;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;
long long powerM(long long x, long long y, long long M = MOD) {
  long long v = 1;
  x = x % M;
  while (y > 0) {
    if (y & 1) v = (v * x) % M;
    y = y >> 1;
    x = (x * x) % M;
  }
  return v;
}
long long power(long long x, long long y) {
  long long v = 1;
  while (y > 0) {
    if (y & 1) v = v * x;
    y = y >> 1;
    x = x * x;
  }
  return v;
}
long long n, k;
long long a[105];
long long dp[105][maxN];
long long solve(long long child, long long candy) {
  if (candy < 0) return 0;
  if (candy == 0) return 1;
  if (child == n + 1) return 1;
  long long& dd = dp[child][candy];
  if (dd != -1) return dd;
  long long mini = min(candy, a[child]);
  dd = solve(child + 1, candy) - solve(child + 1, candy - mini - 1) + MOD;
  dd %= MOD;
  dd += solve(child, candy - 1);
  dd %= MOD;
  return dd;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long ans = solve(1, k) - solve(1, k - 1) + MOD;
  ans %= MOD;
  cout << ans;
  return 0;
}
