#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
const int M = 1e9 + 7;
int n, k;
long long dp[105][N + 5];
int arr[105];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i <= arr[0]; i++) {
    dp[0][i] = 1;
  }
  for (int i = 1; i < n; i++) {
    dp[i][0] = 1;
    for (int j = 1; j <= k; j++) {
      if (j <= arr[i])
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % M;
      else {
        dp[i][j] =
            (dp[i][j - 1] - dp[i - 1][j - arr[i] - 1] + dp[i - 1][j]) % M;
      }
    }
  }
  cout << dp[n - 1][k] << endl;
}
