#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
const long long mod = 1e9 + 7;
using namespace std;
long long dp[110][100010];
long long n, k;
int main() {
  cin >> n >> k;
  long long a[n + 2];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] = (dp[i][j - 1] % mod + dp[i - 1][j] % mod) % mod;
      if (j > a[i]) {
        dp[i][j] = (dp[i][j] % mod - dp[i - 1][j - a[i] - 1] % mod) % mod;
      }
    }
  }
  cout << dp[n][k] % mod;
}
