#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long arr[101];
long long n, k;
long long dp[101][100001];
long long pre[101][100001];
int main() {
  cin >> n >> k;
  for (int x = 1; x <= n; x++) cin >> arr[x];
  dp[0][0] = 1;
  for (int x = 1; x <= k; x++) {
    pre[0][x] = 1;
  }
  for (int x = 1; x <= n; x++) {
    for (int y = 0; y <= k; y++) {
      int l = max((long long)0, y - arr[x]);
      int r = y;
      int sub = 0;
      if (l != 0) sub = pre[x - 1][l - 1];
      dp[x][y] += pre[x - 1][r] - sub;
      dp[x][y] %= mod;
    }
    pre[x][0] = 1;
    for (int y = 1; y <= k; y++) {
      pre[x][y] += dp[x][y] + pre[x][y - 1];
      pre[x][y] %= mod;
    }
  }
  cout << dp[n][k];
}
