#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int m = 1000000007;
long long int solve(vector<int> &v, int i, int k,
                    vector<vector<long long int>> &dp, int size) {
  if (k < 0) return 0;
  if (i == v.size() - 1)
    if (v[i] >= k)
      return 1;
    else
      return 0;
  if (i >= v.size()) return 0;
  if (k == 0) return 1;
  if (dp[i][k] != -1) return dp[i][k];
  long long int ans = 0;
  for (int n = 0; n <= min(k, v[i]); n++) {
    ans = (ans % m + solve(v, i + 1, k - n, dp, size) % m) % m;
  }
  return dp[i][k] = ans % m;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  vector<vector<long long int>> dp(n + 1, vector<long long int>(k + 2, -1));
  cout << solve(v, 0, k, dp, n) << endl;
  return 0;
}
