#include <bits/stdc++.h>
using namespace std;
long long n, k, dp[110][100100], pre[110][100100], a[100100], mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i <= k; i++) pre[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = pre[i - 1][j] - pre[i - 1][max(0LL, j - a[i - 1])] +
                 dp[i - 1][max(0LL, j - a[i - 1])];
      pre[i][j] = dp[i][j];
      if (j > 0) pre[i][j] += pre[i][j - 1];
      pre[i][j] %= mod;
      dp[i][j] %= mod;
    }
  }
  cout << dp[n][k];
}
