#include <bits/stdc++.h>
using namespace std;
long long int dp[100][100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k, i, j;
  cin >> n >> k;
  int ar[n];
  for (i = 0; i < n; i++) cin >> ar[i], dp[i][0] = 1;
  for (j = 0; j < ar[0] + 1; j++) dp[0][j] = 1;
  for (i = 1; i < n; i++)
    for (j = 1; j < k + 1; j++) {
      dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % 1000000007;
      if (j > ar[i])
        dp[i][j] = (dp[i][j] - dp[i][j - ar[i] - 1] + 1000000007) % 1000000007;
    }
  cout << dp[n - 1][k];
}
