#include <bits/stdc++.h>
using namespace std;
int n, k;
long long a[100010];
long long dp[110][100010];
long long suma[110][100010];
long long modul = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) dp[i][0] = suma[i][0] = 1;
  for (int j = 1; j <= k; j++) {
    if (j <= a[1])
      dp[1][j] = 1;
    else
      dp[1][j] = 0;
    suma[1][j] = suma[1][j - 1] + dp[1][j];
  }
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= k; j++)
      dp[i][j] =
          (suma[i - 1][j] - (j > a[i] ? suma[i - 1][j - a[i] - 1] : 0)) % modul,
      suma[i][j] = (suma[i][j - 1] + dp[i][j]) % modul;
  cout << dp[n][k];
  return 0;
}
