#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
long long solve1(long long* a, long long i, long long k, long long n) {
  if (k < 0) return 0;
  if (k == 0) return 1;
  if (i > n) return 0;
  if (dp[i][k] != -1) return dp[i][k];
  dp[i][k] = ((solve1(a, i, k - 1, n) + solve1(a, i + 1, k, n)) % 1000000007 -
              solve1(a, i + 1, k - a[i] - 1, n)) %
             1000000007;
  return dp[i][k];
}
void solve() {
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  long long a[n + 1];
  long long i;
  for (i = 1; i <= n; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 1;
  for (i = 1; i <= n; i++) dp[i][0] = 1;
  for (i = 1; i <= k; i++) dp[0][i] = 0;
  long long len = solve1(a, 1, k, n);
  cout << len << endl;
  return;
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  solve();
  return 0;
}
