#include <bits/stdc++.h>
const int N = 105, K = 1e5 + 5, MOD = 1e9 + 7;
int dp[N][K], dpprefix[N][K], a[N], prefix[N];
int32_t main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    prefix[i] = a[i] + prefix[i - 1];
  }
  dp[0][0] = 1;
  for (int i = 0; i <= K; i++) dpprefix[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= prefix[i]; j++) {
      int l = std::max(0, j - a[i]);
      dp[i][j] = (dpprefix[i - 1][j] - dpprefix[i - 1][l] + dp[i - 1][l]) % MOD;
      if (dp[i][j] < 0) dp[i][j] += MOD;
    }
    dpprefix[i][0] = dp[i][0];
    for (int j = 1; j <= K; j++)
      dpprefix[i][j] = (dp[i][j] + dpprefix[i][j - 1]) % MOD;
  }
  printf("%d\n", dp[n][k]);
  return 0;
}
