#include <bits/stdc++.h>
using namespace std;
int dp[101][100001] = {0};
int util(int dp[][100001], int index, int a[], int n, int sum) {
  if (index == n - 1) {
    if (a[index] < sum) {
      return 0;
    } else
      return 1;
  }
  if (dp[index][sum] != -1) return dp[index][sum];
  int val = 0;
  for (int i = 0; i <= a[index]; i++) {
    if (i <= sum) {
      val = (val + (util(dp, index + 1, a, n, sum - i) % (1000000007))) %
            (1000000007);
    } else
      break;
  }
  return dp[index][sum] = val;
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int index = 0;
  memset(dp, -1, sizeof(dp));
  cout << util(dp, index, a, n, k) << endl;
  return 0;
}
