#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (T i : v) os << i << ' ';
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& v) {
  for (T i : v) os << i << ' ';
  return os;
}
template <class T, class S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  os << v.first << ' ' << v.second;
  return os;
}
template <class T, class S>
ostream& operator<<(ostream& os, const unordered_map<T, S>& v) {
  for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' ';
  return os;
}
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target( \
    "avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
clock_t time_p = clock();
void starboy1299() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
const long long N = 1e5 + 5;
long long dp[105][N];
long long arr[105];
long long n, k;
long long f(long long idx, long long k) {
  if (idx == n) {
    if (k == 0)
      return 1;
    else
      return 0;
  }
  if (k < 0) return 0;
  if (k == 0) return 1;
  if (dp[idx][k] != -1) return dp[idx][k];
  long long ans = 0;
  for (long long i = 0; i <= arr[idx]; i++) {
    ans += f(idx + 1, k - i);
    ans %= 1000000007;
  }
  return dp[idx][k] = ans % 1000000007;
}
void solve() {
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  for (long long i = 0; i < n; i++) cin >> arr[i];
  cout << f(0, k) << '\n';
}
int32_t main() {
  fast();
  long long t = 1;
  while (t--) {
    solve();
  }
  starboy1299();
}
