#include <bits/stdc++.h>
using namespace std;
set<long long int> s[100005];
long long int d[100005];
vector<char> prime(100000 + 1, true);
void sieve(long long int n) {
  prime[0] = prime[1] = false;
  for (long long int i = 2; i <= n; ++i) {
    if (prime[i]) {
      s[i].insert(i);
      for (long long int j = 2 * i; j <= n; j += i) {
        prime[j] = false;
        s[j].insert(i);
      }
    }
  }
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int fastpowMOD(long long int a, long long int p, long long int MOD) {
  if (p == 0) return 1;
  long long int z = fastpowMOD(a, p / 2, MOD);
  z = (z * z) % MOD;
  if (p % 2) z = (z * a) % MOD;
  return z;
}
long long int fastpow(long long int a, long long int p) {
  if (p == 0) return 1;
  long long int z = fastpow(a, p / 2);
  z = (z * z);
  if (p % 2) z = (z * a);
  return z;
}
long long int a, b;
long long int search1(long long int a[], long long int f, long long int n) {
  long long int left = 1;
  long long int right = n + 1;
  while (right - left > 1) {
    long long int mid = left + (right - left) / 2;
    if (a[mid] < f) {
      left = mid;
    } else
      right = mid;
  }
  return a[left];
}
long long int p = 1e9 + 7;
long long int ar[100 + 4];
long long int dp[104][100004];
long long int dpsum[104][100004];
int main() {
  long long int n, k, i, j;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> ar[i];
  ar[0] = 0;
  memset(dp, 0, sizeof(dp));
  memset(dpsum, 0, sizeof(dpsum));
  for (i = 0; i <= k; i++) {
    dpsum[0][i] = 1;
  }
  dp[0][0] = 1;
  for (i = 1; i <= n; i++) {
    dp[i][0] = 1;
    dpsum[i][0] = 1;
    for (j = 1; j <= k; j++) {
      if (j > ar[i])
        dp[i][j] = (dpsum[i - 1][j] - dpsum[i - 1][j - ar[i] - 1]) % p;
      else
        dp[i][j] = (dpsum[i - 1][j] + p) % p;
      dpsum[i][j] = (dpsum[i][j - 1] + dp[i][j]) % p;
    }
  }
  cout << dp[n][k] % p << endl;
  return 0;
}
