#include <bits/stdc++.h>
using namespace std;
int findit(int currentindex, int arr[], int n, int k, int dp[][100001]) {
  if (k <= 0) {
    return 1;
  }
  if (dp[currentindex][k] != -1) {
    return dp[currentindex][k];
  }
  if (currentindex == n - 1) {
    if (k <= arr[currentindex]) {
      dp[currentindex][k] = 1;
      return dp[currentindex][k];
    }
    return 0;
  }
  int ans = 0;
  for (int i = 0; i <= arr[currentindex]; i++) {
    ans = ((ans % 1000000007) +
           (findit(currentindex + 1, arr, n, k - i, dp)) % 1000000007) %
          1000000007;
  }
  dp[currentindex][k] = ans;
  return dp[currentindex][k];
}
int main() {
  int n;
  int k;
  cin >> n;
  cin >> k;
  int arr[n];
  int dp[n][100001];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 100001; j++) {
      dp[i][j] = -1;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << findit(0, arr, n, k, dp);
  return 0;
}
