#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
int a[110];
long long dp[110][N];
long long ps[110][N];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= k; j++) {
      ps[i - 1][j] = dp[i - 1][j];
      if (j) ps[i - 1][j] = (ps[i - 1][j] + ps[i - 1][j - 1]) % mod;
      dp[i][j] = ps[i - 1][j];
      dp[i][j] += mod - ps[i - 1][j - a[i] - 1];
      dp[i][j] %= mod;
    }
  cout << dp[n][k];
  return 0;
}
