#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll MAX = 1e2 + 2;
const ll MAX1 = 1e5 + 2;
const ll INF = 1e15;
const ll MOD = 1e9 + 7;
ll n, k;
ll a[MAX];
ll dp[MAX][MAX1];
ll calc(ll pos, ll rem) {
  if (pos == n and rem == 0) return 1;
  if (pos == n and rem != 0) return 0;
  if (dp[pos][rem] >= 0) return dp[pos][rem];
  ll cnt = 0;
  for (int i = 0; i <= a[pos]; i++) {
    if (rem >= i) {
      cnt += calc(pos + 1, rem - i);
      cnt %= MOD;
    } else
      break;
  }
  return dp[pos][rem] = cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << calc(0, k);
}
