#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << " " << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void inp_out() {}
long long int n, k;
long long int dp[101][100001];
vector<long long int> a;
long long int cal(long long int idx, long long int k) {
  long long int& ans = dp[idx][k];
  if (ans != -1) return ans;
  if (idx == n) return !k;
  ans = 0;
  for (long long int i = 0; i <= min(a[idx], k); ++i)
    ans = (ans + cal(idx + 1, k - i)) % 1000000007;
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  a = vector<long long int>(n);
  for (long long int i = 0; i < n; ++i) cin >> a[i];
  cout << cal(0, k);
  return 0;
}
