#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[101];
int dp[101][100001];
int d = 1e9 + 7;
int solve(int i, int j) {
  if (i >= 0 && j >= 0 && dp[i][j] != -1) return dp[i][j];
  int sum = 0;
  for (int h = 0; h <= a[i]; h++) {
    if ((j - h) >= 0 && i - 1 >= 0) {
      sum += solve(i - 1, j - h);
      sum %= d;
    }
  }
  return dp[i][j] = sum;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = -1;
    }
  }
  for (int i = 0; i <= a[0]; i++) dp[0][i] = 1;
  cout << solve(n - 1, k) << endl;
}
