#include <bits/stdc++.h>
using namespace std;
long long int a[1001], dp[101][100002];
int main() {
  int n, i, j, k;
  long long int m = 1000000007;
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (i = 0; i <= n; i++) dp[i][0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= k; j++) {
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
      if (j > a[i]) {
        dp[i][j] -= dp[i - 1][j - a[i] - 1];
      }
      dp[i][j] = dp[i][j] % m;
    }
  }
  printf("%lld\n", dp[n][k]);
  return 0;
}
