#include <bits/stdc++.h>
using namespace std;
long long int m = pow(10, 9) + 7;
long long int helperfn(vector<long long int>& x, long long int candies,
                       long long int i, vector<vector<long long int> >& dp) {
  if (candies == 0) return 1;
  if (i == x.size()) return 0;
  long long int ans = 0;
  if (dp[i][candies] != -1) return dp[i][candies];
  for (long long int j = 0; j <= x[i]; j++) {
    if (candies - j >= 0) ans += helperfn(x, candies - j, i + 1, dp) % m;
  }
  dp[i][candies] = ans % m;
  return dp[i][candies];
}
int main() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> x(n);
  for (long long int i = 0; i < n; i++) cin >> x[i];
  vector<long long int> ab(k + 2, -1);
  vector<vector<long long int> > dp(n + 2, ab);
  cout << helperfn(x, k, 0, dp);
  return 0;
}
