#include <bits/stdc++.h>
using namespace std;
long long dp[100 + 5][100000 + 5];
const long long mod = 1E9 + 7;
int main() {
  int n, k;
  while (cin >> n >> k) {
    memset(dp, 0, sizeof(dp));
    long long candy[n + 5];
    for (int i = 1; i <= n; ++i) cin >> candy[i];
    for (int i = 0; i <= n; ++i) dp[i][0] = 1;
    for (int i = 1; i <= k; ++i) dp[1][i] = dp[1][i - 1] + (i <= candy[1]);
    for (int i = 2; i <= n; ++i) {
      for (int j = 1; j <= k; ++j) {
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
        if (j >= candy[i]) dp[i][j] -= dp[i - 1][max(0LL, j - candy[i])];
        dp[i][j] %= mod;
      }
    }
    cout << (dp[n][k] - dp[n][k - 1]) % mod << '\n';
  }
}
