#include <bits/stdc++.h>
using namespace std;
long long const MOD = 1e9 + 7;
vector<vector<long long>> dp;
long long solve(vector<long long> &vec, long long k, long long n) {
  if (k == 0) return 1;
  if (k < 0 || n < 0) return 0;
  if (dp[n][k] != -1) return dp[n][k];
  long long ans = 0;
  for (long long i = 0; i <= vec[n]; i++) {
    ans = (ans + solve(vec, k - i, n - 1)) % MOD;
  }
  return dp[n][k] = ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> vec(n);
  for (long long i = 0; i < n; i++) cin >> vec[i];
  dp.resize(n, vector<long long>(k + 1, -1));
  cout << solve(vec, k, n - 1);
  return 0;
}
