#include <bits/stdc++.h>
using namespace std;
void solve();
int main(int argc, char const *argv[]) { solve(); }
int N, K;
int const maxlen = 106;
int a[maxlen];
int const MOD = (1e9) + 7;
long long int memo[maxlen][100005];
long long int findans(int pos, int candies) {
  if (pos == N) return candies == 0;
  if (candies < 0) return 0;
  long long int &ret = memo[pos][candies];
  if (ret != -1) {
    return ret % MOD;
  }
  ret = 0;
  for (int i = 0; i <= min(a[pos], candies); i++) {
    ret = (ret % MOD + findans(pos + 1, candies - i) % MOD) % MOD;
  }
  return ret;
}
void solve() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i];
  memset(memo, -1, sizeof memo);
  long long int ans = findans(0, K);
  cout << ans << '\n';
}
