#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> v(102);
int dp[102][100002] = {0};
int solve(int i, int rem) {
  if (rem == 0) {
    return 1;
  }
  if (i >= n || rem < 0) {
    return 0;
  }
  if (dp[i][rem] != -1) {
    return dp[i][rem];
  }
  int q = 0;
  for (int j = 0; j <= v[i]; j++) {
    q = (q + solve(i + 1, rem - j)) % 1000000007;
  }
  dp[i][rem] = q;
  return q;
}
void initialize() {
  for (int i = 0; i < 102; i++) {
    for (int j = 0; j < 100002; j++) {
      dp[i][j] = -1;
    }
  }
}
int main() {
  initialize();
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  cout << solve(0, k) << endl;
}
