#include <bits/stdc++.h>
using namespace std;
void INP();
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  if (0) return;
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  if (0) return;
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long int arr[101];
long long int n, k;
long long int dp[101][100001];
long long int util(long long int i, long long int candies_left) {
  if (i == n and candies_left == 0) return 1;
  if (i == n and candies_left != 0) return 0;
  if (dp[i][candies_left] != -1) return dp[i][candies_left];
  long long int ans = 0;
  for (long long int j = 0; j < arr[i] + 1; j++) {
    if (candies_left - j >= 0)
      ans += (util(i + 1, candies_left - j)) % (long long int)(1e9 + 7);
    ans %= (long long int)(1e9 + 7);
  }
  return dp[i][candies_left] = ans % (long long int)(1e9 + 7);
}
void alpha() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  cout << util(0, k) % (long long int)(1e9 + 7) << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) alpha();
  return 0;
}
inline void INP() {}
