#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long mod = 1e9 + 7;
long long n, k;
long long a[102], dp[102][N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[1][0] = 1;
  for (int j = 1; j <= k; j++) {
    if (j <= a[1]) dp[1][j] = 1;
    dp[1][j] = (dp[1][j] + dp[1][j - 1]) % mod;
  }
  long long sum = a[1];
  for (int i = 2; i <= n; i++) {
    sum += a[i];
    dp[i][0] = 1;
    for (int j = 1; j <= k; j++) {
      if (j <= sum) {
        if (j <= a[i])
          dp[i][j] = dp[i - 1][j] % mod;
        else
          dp[i][j] = (dp[i - 1][j] - dp[i - 1][j - a[i] - 1]) % mod;
      }
      dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
    }
  }
  if (k == 0)
    cout << 1 << '\n';
  else
    cout << (dp[n][k] - dp[n][k - 1]) % mod << '\n';
}
