#include <bits/stdc++.h>
using namespace std;
using vl = vector<long long>;
using vpl = vector<pair<long long, long long>>;
using vs = vector<string>;
using pl = pair<long long, long long>;
using ll = long long int;
using vb = vector<bool>;
struct hash_pair {
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2> &p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    return hash1 ^ hash2;
  }
};
void printcase(ll &x) { cout << "Case #" << x << ": "; }
void read(vector<ll> &v, ll &n) {
  for (ll i = 0; i < n; ++i) cin >> v[i];
}
void read(ll &x) { cin >> x; }
void read(string &s) { cin >> s; }
void read(int &x) { cin >> x; }
void read(ll a[], ll &n) {
  for (ll i = 0; i < n; ++i) cin >> a[i];
}
void print() { cout << endl; }
void write(vector<ll> &v, ll &n) {
  for (ll i = 0; i < n; ++i) cout << v[i] << " ";
  cout << endl;
}
void write(vector<ll> &v) {
  ll n = v.size();
  for (ll i = 0; i < n; ++i) cout << v[i] << " ";
  cout << endl;
}
void write(ll x) { cout << x << endl; }
void write(string &s) { cout << s << endl; }
void write(int &x) { cout << x << endl; }
void write(ll a[], ll &n) {
  for (ll i = 0; i < n; ++i) cout << a[i] << " ";
  cout << endl;
}
const ll mod = 1e9 + 7;
ll countways(ll &n, vector<ll> &a, vector<vector<ll>> &memo, ll ch, ll ca) {
  if (memo[ch][ca] != -1)
    return (memo[ch][ca] % mod);
  else if (ch == n && ca == 0)
    memo[ch][ca] = 1;
  else if (ch == n)
    memo[ch][ca] = 0;
  else {
    memo[ch][ca] = 0;
    ll b = a[ch];
    for (ll i = 0; i <= min(b, ca); i++) {
      memo[ch][ca] += (countways(n, a, memo, ch + 1, ca - i) % mod);
    }
  }
  return memo[ch][ca] % mod;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  ll n, k;
  cin >> n >> k;
  vl v(n);
  for (ll i = 0; i < n; ++i) cin >> v[i];
  vector<vector<ll>> memo(n + 1, vector<ll>(k + 1, -1));
  write(countways(n, v, memo, 0, k));
  return 0;
}
