#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
const int N = 1e5 + 5;
long long int dp[104][N];
long long int a[N];
int main() {
  long long int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 0; i <= k; i++) dp[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j - a[i] <= 0)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] = (dp[i - 1][j] - dp[i - 1][j - a[i] - 1] + mod) % mod;
    }
    for (int j = 1; j <= k; j++) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
  }
  cout << (dp[n][k] - dp[n][k - 1]) % mod << endl;
}
