#include <bits/stdc++.h>
using namespace std;
long long const MAX = 1e5 + 5;
long long a[MAX];
long long dp[105][MAX] = {};
long long sumx[MAX];
long long const MOD = 1e9 + 7;
long long mod_p(long long x, long long y) { return (x + y + MOD) % MOD; }
long long mod(long long x) {
  if (x >= 0) {
    return x % MOD;
  } else {
    return (100 * MOD - x) % MOD;
  }
}
int main() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][k] = 1;
  for (long long i = 0; i <= n - 1; i++) {
    for (long long j = 0; j <= k; j++) {
      dp[i + 1][j] = mod_p(dp[i + 1][j], dp[i][j]);
      if (j - a[i] - 1 >= 0) {
        dp[i + 1][j - a[i + 1] - 1] =
            mod_p(dp[i + 1][j - a[i + 1] - 1], MOD - dp[i][j]);
      }
    }
    for (long long j = k - 1; j >= 0; j--) {
      dp[i + 1][j] = mod_p(dp[i + 1][j], dp[i + 1][j + 1]);
    }
  }
  cout << dp[n][0] << endl;
}
