#include <bits/stdc++.h>
using namespace std;
inline long long int power(long long int a, long long int b) {
  long long int x = 1;
  while (b) {
    if (b & 1) x *= a;
    a *= a;
    b >>= 1;
  }
  return x;
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int N = 3e5 + 7;
vector<vector<long long int> > adj;
bool vis[N];
long long int a[105];
long long int dp[105][100005];
long long int help(long long int idx, long long int k, long long int n) {
  if (idx == n and k == 0) return 1;
  if (idx == n and k != 0) return 0;
  if (k < 0) return 0;
  long long int& ans = dp[idx][k];
  if (ans != -1) return ans;
  ans = 0;
  for (long long int i = 0; i < a[idx] + 1; i++) {
    ans += help(idx + 1, k - i, n);
  }
  return ans % 1000000007;
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  for (long long int i = 0; i < n; i++) cin >> a[i];
  cout << help(0, k, n) << "\n";
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(9) << fixed;
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
