#include <bits/stdc++.h>
using namespace std;
long long int dp[102][100004], s[102][100004], a[102];
long long int fsum(int i, int l, int r) {
  if (l < 0) l = 0;
  if (l == 0)
    return s[i][r];
  else
    return (s[i][r] - s[i][l - 1]);
}
int main() {
  long long int n, k;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    dp[i][0] = 1;
    s[i][0] = 1;
  }
  for (int i = 1; i <= k; i++) {
    dp[0][i] = 0;
    s[0][i] = 0;
  }
  dp[0][0] = 0;
  s[0][0] = 0;
  long long int sum = 0;
  for (int i = 1; i <= k; i++) {
    if (i <= a[1])
      dp[1][i] = 1;
    else
      dp[1][i] = 0;
    s[1][i] = (dp[1][i] + s[1][i - 1]) % 1000000007;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      long long int val = fsum(i - 1, j - a[i], j);
      dp[i][j] = val;
      s[i][j] = (s[i][j - 1] + dp[i][j]) % 1000000007;
    }
  }
  cout << dp[n][k];
}
