#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int n, k;
int a[101];
long long dp[101][100001];
long long pre[101][100001];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (int i = 0; i < int(n); i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    dp[i][0] = 1;
    pre[i][0] = 1;
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 0; j < n; j++) {
      if (j == 0) {
        if (a[j] >= i)
          dp[j][i] = 1;
        else
          dp[j][i] = 0;
      } else {
        if (a[j] >= i)
          dp[j][i] = pre[j - 1][i];
        else
          dp[j][i] = pre[j - 1][i] - pre[j - 1][i - a[j] - 1];
      }
      pre[j][i] = pre[j][i - 1] + dp[j][i];
      pre[j][i] %= MOD;
    }
  }
  cout << dp[n - 1][k] % MOD;
  return 0;
}
