#include <bits/stdc++.h>
using namespace std;
void DebugPrint(double a[], int n) {}
long long int memo[100 + 1][100000 + 1];
long long int Comp(int n, int k, vector<int> &a) {
  if (memo[n][k] >= 0) {
    return memo[n][k];
  }
  if (k < 0) {
    return 0;
  }
  if (n == 0) {
    if (k == 0) {
      return 1;
    } else {
      return 0;
    }
  }
  long long int num = 0;
  for (int i = 0; i <= a[n - 1]; ++i) {
    num += Comp(n - 1, k - i, a);
  }
  num %= 1000000007;
  memo[n][k] = num;
  return num;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      memo[i][j] = -1;
    }
  }
  long long int num = Comp(n, k, a);
  cout << num << endl;
  return 0;
}
