#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int arr[102];
long long dp[102][100003];
long long kum[102][100003];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  dp[1][0] = kum[1][0] = 1;
  for (int i = 1; i <= k; i++) {
    if (i <= arr[1]) dp[1][i] = 1;
    kum[1][i] = kum[1][i - 1] + dp[1][i];
  }
  for (int i = 2; i <= n; i++) {
    dp[i][0] = kum[i][0] = 1;
    for (int j = 1; j <= k; j++) {
      if (j <= arr[i])
        dp[i][j] = kum[i - 1][j] % MOD;
      else
        dp[i][j] = (kum[i - 1][j] - kum[i - 1][j - arr[i] - 1]) % MOD;
      kum[i][j] = (kum[i][j - 1] + dp[i][j]) % MOD;
    }
  }
  cout << dp[n][k] % MOD;
  return 0;
}
