#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long cache[105][100005];
long long a[105];
long long calculate(long long n, long long k) {
  cerr << "n"
       << ": " << n << " | "
       << "k"
       << ": " << k << endl;
  ;
  if (n == 1) {
    if (k >= 0 && k <= a[n])
      return 1;
    else
      return 0;
  }
  if (k == 0) return 1;
  if (cache[n][k] != -1) return cache[n][k];
  long long i = 0;
  cache[n][k] = 0;
  while (i <= a[n] && k - i >= 0) {
    cache[n][k] += calculate(n - 1, k - i);
    cache[n][k] %= 1000000007;
    i++;
  }
  return cache[n][k];
}
void solve() {
  long long n, k;
  cin >> n >> k;
  long long i, j;
  for (i = 1; i <= n; i++)
    for (j = 0; j <= k; j++) cache[i][j] = -1;
  for (i = 1; i <= n; i++) cin >> a[i];
  cout << calculate(n, k);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) solve();
  return 0;
}
