#include <bits/stdc++.h>
using namespace std;
long long int n;
long long int arr[101];
long long int dp[100005][105];
long long int func(long long int k) {
  for (long long int i = 0; i <= n; i++) dp[0][i] = 1;
  for (long long int i = 0; i <= k; i++) dp[i][0] = 1;
  for (long long int i = 1; i <= k; i++) {
    for (long long int j = 1; j <= n; j++) {
      if (arr[j] >= i) {
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % 1000000007;
      } else {
        long long int z = dp[i][j - 1] - dp[i - arr[j] - 1][j - 1];
        dp[i][j] = (z + dp[i - 1][j]) % 1000000007;
      }
    }
  }
  return dp[k][n] - dp[k - 1][n];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    long long int k;
    cin >> n >> k;
    for (long long int i = 1; i <= n; i++) cin >> arr[i];
    memset(dp, 0, sizeof(dp));
    if (k == 0)
      cout << 1;
    else
      cout << func(k);
  }
  return 0;
}
