#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long a[105];
long long dp[101][100001];
long long n, k;
signed main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      dp[i][j] += dp[i - 1][j];
      dp[i][j] %= mod;
      if (j) dp[i][j] += dp[i][j - 1];
      if (j - a[i] - 1 >= 0) {
        dp[i][j] += mod;
        dp[i][j] -= dp[i - 1][j - a[i] - 1];
        dp[i][j] %= mod;
      }
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
