#include <bits/stdc++.h>
using namespace std;
inline bool Read(int& x) {
  x = 0;
  int c;
  int sign = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') sign = -1;
  x = c ^ '0';
  while ((c = getchar()) >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ '0');
  x *= sign;
  return 1;
}
inline bool Write(int x) {
  if (x >= 10) Write(x / 10);
  putchar(x % 10 + '0');
  return 1;
}
const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;
const int Mod = 1000000007;
int n, k;
int a[110];
long long dp[2][100100];
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  dp[0][a[0] + 1] = -1;
  for (int j = 1; j <= k; j++) {
    dp[0][j] = dp[0][j] + dp[0][j - 1];
    dp[0][j] %= Mod;
  }
  for (int i = 1; i < n; i++) {
    int now = i & 1;
    int pre = (i - 1) & 1;
    for (int j = 0; j < k + 1; j++) dp[now][j] = 0;
    for (int j = 0; j <= k; j++) {
      dp[now][j] += dp[pre][j];
      dp[now][j] %= Mod;
      dp[now][min(j + a[i] + 1, k + 1)] -= dp[pre][j];
      dp[now][min(j + a[i] + 1, k + 1)] %= Mod;
    }
    for (int j = 1; j <= k; j++) {
      dp[now][j] = dp[now][j] + dp[now][j - 1];
      dp[now][j] %= Mod;
    }
  }
  cout << dp[(n - 1) & 1][k];
  return 0;
}
