#include <bits/stdc++.h>
using namespace std;
long long int dp[101][100001];
long long int pre[101][100001];
int main() {
  int i, j, n, k, c;
  long long int mod = 1000000007;
  int a[100009];
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i <= n; i++) {
    for (j = 0; j <= k; j++) {
      dp[i][j] = 0;
      pre[i][j] = 0;
    }
  }
  dp[0][0] = 1;
  for (j = 0; j <= n; j++) {
    dp[j][0] = 1;
    pre[j][0] = 1;
  }
  for (j = 1; j <= n; j++) {
    long long int xx = 0;
    for (c = 0; c <= k; c++) {
      xx = (xx + dp[j - 1][c]) % mod;
      pre[j - 1][c] = xx;
    }
    for (i = 1; i <= k; i++) {
      if (j == 1) {
        if (i - a[0] > 0)
          dp[j][i] = 0;
        else if (i - a[0] < 0)
          dp[j][i] = 0;
        else if (i == a[0])
          dp[j][i] = 1;
      } else {
        if (i - a[j - 1] > 0)
          dp[j][i] = (pre[j - 1][i] - pre[j - 1][i - a[j - 1] - 1] + mod) % mod;
        else
          dp[j][i] = pre[j - 1][i];
      }
    }
  }
  cout << dp[n][k] << endl;
}
