#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll dp[101][100010], a[101];
ll calc(ll idx, ll K) {
  if (K == 0ll) return 1ll;
  if (dp[idx][K] != -1ll) return dp[idx][K] = dp[idx][K] % 1000000007;
  dp[idx][K] = 0ll;
  for (ll i = 0ll; i <= a[idx]; i++)
    if (K >= i) dp[idx][K] += calc(idx - 1, K - i), dp[idx][K] %= 1000000007;
  return dp[idx][K] = dp[idx][K] % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll N;
  cin >> N;
  ll K;
  cin >> K;
  for (ll i = 1ll; i <= N; i++) cin >> a[i];
  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= K; j++) dp[i][j] = -1ll;
  for (int i = 0; i <= K; i++) dp[0][i] = 0ll;
  dp[0][0] = 1ll;
  cout << calc(N, K) << '\n';
  return 0;
}
