#include <bits/stdc++.h>
using namespace std;
long long solve(int i, vector<int>& A, int k, vector<vector<long long> >& dp) {
  if (dp[i][k] >= 0) return dp[i][k];
  int n = A.size();
  if (i == n) {
    if (k == 0) {
      dp[i][k] = 1;
      return 1;
    } else {
      dp[i][k] = 0;
      return 0;
    }
  }
  long long cnt = 0;
  for (int a = 0; a <= A[i]; a++) {
    if (k >= a) cnt = (cnt + solve(i + 1, A, k - a, dp)) % (long long)(1e9 + 7);
  }
  dp[i][k] = cnt;
  return cnt;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  for (int i = 0; i < n; i++) cin >> A[i];
  vector<vector<long long> > dp(n + 1, vector<long long>(k + 1, -1));
  cout << solve(0, A, k, dp) << "\n";
  return 0;
}
