#include <bits/stdc++.h>
int a[110];
int dp[110][100010];
const int mod = 1e9 + 7;
int main() {
  int n, k;
  std::cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    std::cin >> a[i];
  }
  for (int i = 1; i <= k; i++) {
    dp[0][i] = 1;
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
      if (j - a[i] > 0) {
        dp[i][j] -= dp[i - 1][j - a[i] - 1];
        dp[i][j] += mod;
        dp[i][j] %= mod;
      }
    }
  }
  std::cout << dp[n][k] - dp[n][k - 1] << std::endl;
}
