#include <bits/stdc++.h>
using namespace std;
template <typename F, typename S>
ostream &operator<<(ostream &os, const pair<F, S> &p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  typename vector<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << "[";
  typename set<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}
template <typename F, typename S>
ostream &operator<<(ostream &os, const map<F, S> &v) {
  os << "[";
  typename map<F, S>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ", ";
    os << it->first << " = " << it->second;
  }
  return os << "]";
}
const long long int mod = 1000000007;
const long long int inf = (long long int)1e15;
long long int power(long long int a, long long int b, long long int m = mod) {
  if (b == 0) return 1;
  if (b == 1) return (a % m);
  long long int x = power(a, b / 2, m);
  x = (x * x) % m;
  if (b % 2) x = (x * a) % m;
  return x;
}
long long int max(long long int a, long long int b) { return (a > b ? a : b); }
long long int min(long long int a, long long int b) { return (a < b ? a : b); }
const int N = 105, K = 1e5 + 5;
int n, k;
int dp[N][K], a[N];
bool memo[N][K];
long long int func(int idx, int rem) {
  if (rem < 0) return 0;
  if (rem == 0) return 1;
  if (idx == n + 1) {
    if (rem == 0)
      return 1;
    else
      return 0;
  }
  if (memo[idx][rem]) return dp[idx][rem];
  memo[idx][rem] = true;
  long long int ret = 0;
  for (int i = 0; i <= a[idx]; i++) {
    ret += func(idx + 1, rem - i);
    if (ret > mod) ret -= mod;
  }
  return dp[idx][rem] = ret;
}
void solve() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long int ans = func(1, k);
  cout << ans << "\n";
  ;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1, num = 1;
  while (t--) {
    solve();
  }
  return 0;
}
