#include <bits/stdc++.h>
const int mod = (int)1e9 + 7;
int dp[100005];
int main(void) {
  int n, k;
  scanf("%d %d", &n, &k);
  dp[0] = 1;
  for (int child = 1; child <= n; child++) {
    int upto;
    scanf("%d", &upto);
    int prefix[k + 5];
    for (int used = k; used >= 0; used--) {
      int tem = dp[used];
      int l = used + 1, r = std::min(k, used + upto);
      if (l <= r) {
        prefix[l] = (prefix[l] % mod + tem % mod) % mod;
        if (r + 1 <= k) prefix[r + 1] = (prefix[r + 1] % mod - tem % mod) % mod;
      }
    }
    int sum = 0;
    for (int i = 1; i <= k; i++) {
      sum = (sum % mod + prefix[i] % mod) % mod;
      dp[i] = (dp[i] % mod + sum % mod) % mod;
    }
  }
  printf("%d", dp[k]);
  return 0;
}
