#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vector<T>>;
template <class T>
inline bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
ll A[100];
ll dp[101][100005];
int main() {
  init();
  ll N, K;
  cin >> N >> K;
  for (ll i = 0; i < (N); i++) cin >> A[i];
  ll sum = 0;
  dp[0][0] = 1;
  for (ll i = 0; i < (N); i++) {
    sum += A[i];
    for (ll j = 0; j < (sum); j++) (dp[i][j + 1] += dp[i][j]) %= MOD;
    for (ll j = 0; j < (sum + 1); j++) {
      if (j - A[i] <= 0)
        dp[i + 1][j] = dp[i][j];
      else
        (dp[i + 1][j] = dp[i][j] - dp[i][j - A[i] - 1] + MOD) %= MOD;
    }
  }
  cout << dp[N][K] << endl;
}
