#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
long long fun(vector<long long> &v, long long c, long long cc,
              vector<vector<long long> > &dp) {
  if (c == v.size() && cc == 0) return (dp[c][cc] = 1);
  if (c == v.size() && cc > 0) return (dp[c][cc] = 0);
  if (dp[c][cc] == -1) {
    long long ans = 0;
    for (long long i = 0; i < v[c] + 1; i++)
      if (cc >= i) ans = (ans + fun(v, c + 1, cc - i, dp)) % MOD;
    dp[c][cc] = ans;
  }
  return dp[c][cc];
}
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  vector<vector<long long> > dp(n + 1, vector<long long>(k + 1, -1));
  for (long long i = 0; i < n; i++) cin >> v[i];
  cout << fun(v, 0, k, dp);
}
