#include <bits/stdc++.h>
const long long inf = 1e15;
const long long size = 100005;
const long long mod = 1e9 + 7;
long long dp[101][size], a[size], pre[101][size], n, k;
inline long long add(long long a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
inline long long sub(long long a, long long b) {
  a -= b;
  if (a < 0) a += mod;
  return a;
}
int32_t main() {
  scanf("%lld %lld", &n, &k);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (long long i = 0; i <= k; i++) pre[0][i] = 1;
  for (long long i = 0; i <= n; i++) pre[i][0] = dp[i][0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= k; j++) {
      long long first = (j - a[i] - 1 >= 0) ? pre[i - 1][j - a[i] - 1] : 0;
      long long last = pre[i - 1][j];
      dp[i][j] = add(dp[i][j], sub(last, first));
      pre[i][j] = add(pre[i][j - 1], dp[i][j]);
    }
  }
  std::cout << dp[n][k] << "\n";
}
