#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
const long double eps = 1e-7;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int dx[8] = {+1, +1, +1, 0, 0, -1, -1, -1};
int dy[8] = {+1, 0, -1, +1, -1, +1, 0, -1};
long long power(long long x, long long y) {
  long long res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
template <typename T>
T gcd(T a, T mp) {
  if (a == 0) return mp;
  return gcd(mp % a, a);
}
template <typename T>
T powm(T a, T mp, long long m) {
  T cnt = 1;
  while (mp > 0) {
    if (mp % 2 == 1) cnt = (cnt * a) % m;
    mp /= 2;
    a = (a * a) % m;
  }
  return cnt % m;
}
long long ncr(long long n, long long r) {
  long long res = 1;
  if (r > n) return 0;
  if (r > n - r) r = n - r;
  for (long long i = 0; i < r; i++) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
long long sqr(long long x) { return x * x; }
void prec() {}
int sum = 0, dp[102][N], now[102][N];
void run() {
  int n, k;
  cin >> n >> k;
  int a[n + 1];
  a[0] = 0;
  for (long long i = (1); i <= (n); ++i) cin >> a[i];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int j = 0; j <= k; j++) {
    now[0][j] += (dp[0][j] + (j == 0 ? 0 : now[0][j - 1])) % 1000000007;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      dp[i][j] =
          now[i - 1][j] - (j - a[i] - 1 < 0 ? 0 : (now[i - 1][j - a[i] - 1]));
      if (dp[i][j] < 0) dp[i][j] += 1000000007;
      dp[i][j] %= 1000000007;
    }
    memset(now, 0, sizeof(now));
    for (int j = 0; j <= k; j++) {
      now[i][j] += (dp[i][j] + (j == 0 ? 0 : now[i][j - 1])) % 1000000007;
    }
  }
  cout << dp[n][k] << "\n";
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int tc = 1;
  prec();
  for (long long i = 0; i < tc; ++i) run();
  return 0;
}
