#include <bits/stdc++.h>
using namespace std;
int mod = 1e9;
vector<vector<int>> dp;
int f(vector<int> &A, int i, int k) {
  if (i == A.size() && k == 0) return 1;
  if (k < 0 || i >= A.size()) return 0;
  if (dp[i][k] != -1) return dp[i][k];
  long long ans = 0;
  for (int j = 0; j <= A[i]; j++) ans = (ans + f(A, i + 1, k - j)) % (mod + 7);
  return dp[i][k] = ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  dp.resize(n + 1, vector<int>(k + 1, -1));
  for (int &i : A) cin >> i;
  cout << f(A, 0, k);
}
