#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long arr[105], dp[105][100005], pre[105][100005];
int32_t main() {
  scanf("%lld %lld", &n, &k);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
  }
  pre[1][0] = 1, dp[1][0] = 1;
  for (long long i = 1; i <= k; i++) {
    if (i <= arr[1]) {
      dp[1][i] = 1;
    }
    pre[1][i] = (pre[1][i - 1] + dp[1][i]) % 1000000007;
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      dp[i][j] = (pre[i - 1][j]);
      if ((j - arr[i]) > 0) {
        dp[i][j] -= pre[i - 1][(j - arr[i]) - 1];
      }
      if (j == 0) {
        pre[i][j] = dp[i][j];
      } else {
        pre[i][j] = (dp[i][j] + pre[i][j - 1]) % 1000000007;
      }
    }
  }
  printf("%lld\n", ((dp[n][k]) % 1000000007));
}
