#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
int main() {
  long long n, k;
  scanf("%lld%lld", &n, &k);
  long long a[n + 5];
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  if (!k) {
    printf("1");
    return 0;
  }
  dp[1][0] = 1;
  for (int i = 1; i <= a[1]; ++i) {
    dp[1][i] = dp[1][i - 1] + 1;
  }
  for (int i = a[1] + 1; i <= k; ++i) {
    dp[1][i] = dp[1][i - 1];
  }
  for (int i = 2; i <= n; ++i) {
    dp[i][0] = dp[i - 1][0];
    for (int j = 1; j <= k; ++j) {
      int r = j;
      int l = j - min(j, (int)a[i]);
      if (!l) {
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][r]) % 1000000007ll;
      } else {
        dp[i][j] =
            (dp[i][j - 1] + dp[i - 1][r] - dp[i - 1][l - 1]) % 1000000007ll;
      }
    }
  }
  printf("%lld", dp[n][k] - dp[n][k - 1]);
  return 0;
}
