#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
const long long N = 1e5 + 5;
long long dp[105][N];
long long n, x;
long long a[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> x;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  dp[0][0] = 1;
  dp[0][1] = -1;
  for (long long i = 0; i < n; ++i) {
    long long s = 0;
    for (long long j = 0; j <= x; ++j) {
      s += dp[i][j];
      s = (s + mod) % mod;
      if (s > 0) {
        dp[i + 1][j] += s;
        dp[i + 1][j] %= mod;
        if (j + a[i] + 1 < N) {
          dp[i + 1][j + a[i] + 1] -= s;
          dp[i + 1][j + a[i] + 1] %= mod;
        }
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i <= x; ++i) {
    ans += dp[n][i];
    if (ans <= 0) {
      cout << 0 << "\n";
      return 0;
    }
    if (ans >= mod) ans %= mod;
  }
  cout << ans % mod << "\n";
}
