#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("tune=native")
#pragma GCC target("avx")
using namespace std;
const long long mod = 1000000007;
long long n, k, a[101];
long long dp[101][100010];
signed main() {
  scanf("%lld", &(n));
  scanf("%lld", &(k));
  for (long long i = 0; i < (long long)(n); i++) scanf("%lld", &(a[i]));
  dp[0][k] = 1;
  for (long long i = 0; i < (long long)(n); i++) {
    for (long long j = 0; j < (long long)(k + 1); j++) {
      dp[i + 1][j] += dp[i][j];
      if (j - a[i] > 0) dp[i + 1][j - a[i] - 1] -= dp[i][j];
    }
    for (long long j = (long long)(k + 1) - 1; j >= 0; j--)
      dp[i + 1][j] = (dp[i + 1][j + 1] + dp[i + 1][j]) % mod;
  }
  cout << dp[n][0] << endl;
}
