#include <bits/stdc++.h>
using namespace std;
long long dp[110][100010];
int niz[110];
int main() {
  int n;
  long long k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> niz[i];
  dp[0][0] = 1;
  for (int i = 1; i <= k; i++) dp[0][i] += dp[0][i - 1];
  for (int i = 1; i <= n; i++) {
    int l = niz[i] + 1;
    for (int j = 0; j <= k; j++) {
      if (l > j) {
        if (j == 0)
          dp[i][j] = 1;
        else {
          dp[i][j] = dp[i][j - 1];
          dp[i][j] += dp[i - 1][j];
          dp[i][j] %= 1000000007;
        }
      } else {
        dp[i][j] = dp[i][j - 1];
        dp[i][j] += (dp[i - 1][j] - dp[i - 1][j - l]);
        dp[i][j] %= 1000000007;
      }
    }
  }
  if (k == 0)
    cout << 1 << endl;
  else
    cout << dp[n][k] - dp[n][k - 1] << endl;
}
