#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long N = 6e5 + 5;
long long powmod(long long base, long long exp, long long mod) {
  long long res = 1LL;
  while (exp > 0) {
    if (exp & 1LL) res = (res * base) % mod;
    exp /= 2LL;
    base = (base * base) % mod;
  }
  return res % mod;
}
long long dp[105][100005];
long long pre[105][100005];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long a[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  a[0] = 0;
  for (long long i = 1; i <= n; i++) {
    dp[i][0] = 1;
    pre[i][0] = 1;
  }
  for (long long i = 1; i <= k; i++) {
    if (i <= a[1]) {
      dp[1][i] = 1;
    }
    pre[1][i] = (pre[1][i - 1] + dp[1][i]) % 1000000007;
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 1; j <= k; j++) {
      dp[i][j] = pre[i - 1][j];
      if (j - a[i] - 1 < 0) {
      } else {
        dp[i][j] -= pre[i - 1][j - a[i] - 1];
      }
      pre[i][j] = (pre[i][j - 1] + dp[i][j]) % 1000000007;
      pre[i][j] %= 1000000007;
      dp[i][j] %= 1000000007;
    }
  }
  cout << dp[n][k] % 1000000007 << endl;
  return 0;
}
