#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long a[109], dp[109][100009], s[109][100009];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] = (s[i - 1][j] % 1000000007);
      if (j - a[i] > 0)
        dp[i][j] -= s[i - 1][j - a[i] - 1] % 1000000007;
      else
        dp[i][j]++;
      s[i][j] = (dp[i][j] + s[i][j - 1]) % 1000000007;
    }
    dp[i][0] = 1;
  }
  cout << dp[n][k] % 1000000007 << "\n";
}
