#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e18;
long long int dp[101][100001];
void take_fileIO() { return; }
void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> candies(n + 1);
  for (long long int i = 1; i < 1 + n; i += 1) cin >> candies[i];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (int j = 1; j <= k; j++) {
    dp[0][j] = 0;
  }
  for (int j = 1; j <= k; j++) {
    if (candies[1] >= j)
      dp[1][j] = 1;
    else
      dp[1][j] = 0;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] =
          (dp[i][j - 1] % 1000000007 + dp[i - 1][j] % 1000000007) % 1000000007;
      if (candies[i] + 1 <= j)
        dp[i][j] = (1000000007 + dp[i][j] % 1000000007 -
                    dp[i][j - candies[i] - 1] % 1000000007) %
                   1000000007;
    }
  }
  cout << dp[n][k] << endl;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  solve();
  return 0;
}
