#include <bits/stdc++.h>
using namespace std;
long long dp[2][100005];
const int mod = 1e9 + 7;
long long a[101];
int main() {
  long long n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = k; i >= k - a[0]; i--) {
    dp[0][i] = 1LL;
  }
  for (int i = 1; i <= k; i++) {
    dp[0][i] = (dp[0][i] + dp[0][i - 1]) % mod;
  }
  bool t = 1;
  for (int i = 1; i < n; i++, t = !t) {
    dp[t][0] = dp[!t][a[i]];
    for (int j = 1; j <= k; j++) {
      dp[t][j] = ((dp[t][j] + dp[t][j - 1] + dp[!t][min(k, j + a[i])] -
                   dp[!t][j - 1]) %
                      mod +
                  mod) %
                 mod;
    }
  }
  cout << dp[!t][0] % mod;
}
